From 473dd2fdd96fd27fd6d340425e6726d950d4d4e9 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Fri, 21 Feb 2025 18:22:54 -0500 Subject: [PATCH] Refactor Snapshots to Be Fully Configuration Based (#7153) Co-authored-by: Erich Gubler --- naga/tests/in/6220-break-from-loop.param.ron | 1 + .../in/6438-conflicting-idents.param.ron | 3 + .../in/6772-unpack-expr-accesses.param.ron | 3 + naga/tests/in/6772-unpack-expr-accesses.ron | 2 - naga/tests/in/abstract-types-const.param.ron | 3 + .../abstract-types-function-calls.param.ron | 3 + .../in/abstract-types-operators.param.ron | 3 + naga/tests/in/abstract-types-return.param.ron | 3 + naga/tests/in/abstract-types-var.param.ron | 3 + naga/tests/in/access.param.ron | 1 + naga/tests/in/array-in-ctor.param.ron | 1 + .../array-in-function-return-type.param.ron | 1 + .../in/atomicCompareExchange-int64.param.ron | 1 + naga/tests/in/atomicCompareExchange.param.ron | 3 + naga/tests/in/atomicOps-float32.param.ron | 1 + .../in/atomicOps-int64-min-max.param.ron | 1 + naga/tests/in/atomicOps-int64.param.ron | 1 + naga/tests/in/atomicOps.param.ron | 3 + naga/tests/in/atomicTexture-int64.param.ron | 1 + naga/tests/in/atomicTexture.param.ron | 1 + naga/tests/in/binding-arrays.param.ron | 3 +- naga/tests/in/binding-buffer-arrays.param.ron | 4 +- naga/tests/in/bitcast.param.ron | 3 + naga/tests/in/bitcast.params.ron | 16 - naga/tests/in/bits.param.ron | 1 + naga/tests/in/boids.param.ron | 1 + .../in/bounds-check-dynamic-buffer.param.ron | 3 +- .../in/bounds-check-image-restrict.param.ron | 1 + .../in/bounds-check-image-rzsw.param.ron | 1 + naga/tests/in/bounds-check-restrict.param.ron | 1 + .../in/bounds-check-zero-atomic.param.ron | 1 + naga/tests/in/bounds-check-zero.param.ron | 1 + naga/tests/in/break-if.param.ron | 3 + naga/tests/in/collatz.param.ron | 1 + naga/tests/in/const-exprs.param.ron | 3 + naga/tests/in/const_assert.param.ron | 3 + naga/tests/in/constructors.param.ron | 1 + naga/tests/in/control-flow.param.ron | 1 + naga/tests/in/cross.param.ron | 3 + naga/tests/in/cubeArrayShadow.param.ron | 3 + .../in/debug-symbol-large-source.param.ron | 3 +- naga/tests/in/debug-symbol-simple.param.ron | 3 +- naga/tests/in/debug-symbol-terrain.param.ron | 3 +- naga/tests/in/diagnostic-filter.param.ron | 1 + naga/tests/in/dualsource.param.ron | 1 + naga/tests/in/empty.param.ron | 1 + naga/tests/in/extra.param.ron | 1 + naga/tests/in/f64.param.ron | 1 + ...e_point_size_vertex_shader_webgl.param.ron | 1 + naga/tests/in/fragment-output.param.ron | 3 + naga/tests/in/functions-webgl.param.ron | 1 + naga/tests/in/functions.param.ron | 1 + naga/tests/in/globals.param.ron | 1 + .../in/glsl/800-out-of-bounds-panic.param.ron | 3 + .../tests/in/glsl/896-push-constant.param.ron | 3 + .../in/glsl/double-math-functions.param.ron | 3 + .../{variations.glsl => glsl/variations.frag} | 0 naga/tests/in/glsl/variations.param.ron | 3 + naga/tests/in/glsl/vector-functions.param.ron | 3 + naga/tests/in/hlsl-keyword.param.ron | 3 + naga/tests/in/image.param.ron | 3 +- naga/tests/in/index-by-value.param.ron | 3 + naga/tests/in/int64.param.ron | 1 + naga/tests/in/interface.param.ron | 2 + naga/tests/in/interpolate.param.ron | 1 + naga/tests/in/interpolate_compat.param.ron | 1 + naga/tests/in/invariant.param.ron | 1 + naga/tests/in/lexical-scopes.param.ron | 3 + naga/tests/in/local-const.param.ron | 4 +- naga/tests/in/math-functions.param.ron | 1 + naga/tests/in/module-scope.param.ron | 3 + naga/tests/in/msl-varyings.param.ron | 3 + naga/tests/in/multiview.param.ron | 1 + naga/tests/in/multiview_webgl.param.ron | 1 + naga/tests/in/must-use.param.ron | 3 + naga/tests/in/operators.param.ron | 1 + ...rrides-atomicCompareExchangeWeak.param.ron | 3 +- naga/tests/in/overrides-ray-query.param.ron | 3 +- naga/tests/in/overrides.param.ron | 3 +- naga/tests/in/padding.param.ron | 1 + naga/tests/in/phony_assignment.param.ron | 3 + naga/tests/in/phony_assignment.ron | 2 - naga/tests/in/pointers.param.ron | 1 + naga/tests/in/policy-mix.param.ron | 1 + naga/tests/in/push-constants.param.ron | 1 + naga/tests/in/quad.param.ron | 1 + naga/tests/in/ray-query.param.ron | 3 +- naga/tests/in/resource-binding-map.param.ron | 3 +- .../runtime-array-in-unused-struct.param.ron | 3 + .../in/sample-cube-array-depth-lod.param.ron | 1 + naga/tests/in/separate-entry-points.param.ron | 1 + naga/tests/in/shadow.param.ron | 1 + naga/tests/in/skybox.param.ron | 1 + naga/tests/in/sprite.param.ron | 1 + .../in/spv/atomic_compare_exchange.param.ron | 3 + naga/tests/in/spv/atomic_exchange.param.ron | 3 + ...tomic_global_struct_field_vertex.param.ron | 3 + naga/tests/in/spv/atomic_i_add_sub.param.ron | 3 + .../tests/in/spv/atomic_i_decrement.param.ron | 3 + .../tests/in/spv/atomic_i_increment.param.ron | 3 + .../in/spv/atomic_load_and_store.param.ron | 3 + .../in/spv/binding-arrays.dynamic.param.ron | 3 + .../in/spv/binding-arrays.static.param.ron | 3 + ...ltin-accessed-outside-entrypoint.param.ron | 3 + naga/tests/in/spv/degrees.param.ron | 3 + naga/tests/in/spv/do-while.param.ron | 3 + naga/tests/in/spv/empty-global-name.param.ron | 3 + naga/tests/in/spv/fetch_depth.param.ron | 3 + .../inv-hyperbolic-trig-functions.param.ron | 3 + naga/tests/in/spv/quad-vert.param.ron | 3 + naga/tests/in/spv/shadow.param.ron | 3 + .../spv/spec-constants-issue-5598.param.ron | 3 + naga/tests/in/spv/spec-constants.param.ron | 3 + .../in/spv/subgroup-operations-s.param.ron | 1 + .../in/spv/unnamed-gl-per-vertex.param.ron | 3 + naga/tests/in/standard.param.ron | 1 + naga/tests/in/storage-textures.param.ron | 3 + naga/tests/in/struct-layout.param.ron | 3 + naga/tests/in/subgroup-operations.param.ron | 1 + naga/tests/in/template-list-ge.param.ron | 3 + naga/tests/in/texture-arg.param.ron | 1 + naga/tests/in/type-alias.param.ron | 3 + .../unconsumed_vertex_outputs_frag.param.ron | 1 + .../unconsumed_vertex_outputs_vert.param.ron | 5 + ...er-grad-workaround-if-instructed.param.ron | 1 + .../in/vertex-pulling-transform.param.ron | 1 + .../tests/in/workgroup-uniform-load.param.ron | 3 + naga/tests/in/workgroup-var-init.param.ron | 1 + .../glsl/variations.frag.main.Fragment.glsl | 20 + naga/tests/out/spv/access.spvasm | 1631 ++++++++++------ naga/tests/out/spv/boids.spvasm | 820 +++++--- .../spv/bounds-check-image-restrict.spvasm | 956 +++++---- .../out/spv/bounds-check-image-rzsw.spvasm | 1060 +++++----- naga/tests/out/spv/collatz.spvasm | 291 +-- naga/tests/out/spv/image.spvasm | 1722 ++++++++++------- naga/tests/out/spv/interpolate.spvasm | 589 +++--- naga/tests/out/spv/interpolate_compat.spvasm | 561 +++--- naga/tests/out/spv/padding.spvasm | 211 +- naga/tests/out/spv/pointers.spvasm | 161 +- naga/tests/out/spv/policy-mix.spvasm | 312 +-- naga/tests/out/spv/quad.spvasm | 256 ++- naga/tests/out/spv/shadow.spvasm | 963 +++++---- naga/tests/out/spv/texture-arg.spvasm | 115 +- naga/tests/out/spv/workgroup-var-init.spvasm | 150 +- naga/tests/snapshots.rs | 651 ++----- 145 files changed, 6233 insertions(+), 4521 deletions(-) create mode 100644 naga/tests/in/6438-conflicting-idents.param.ron create mode 100644 naga/tests/in/6772-unpack-expr-accesses.param.ron delete mode 100644 naga/tests/in/6772-unpack-expr-accesses.ron create mode 100644 naga/tests/in/abstract-types-const.param.ron create mode 100644 naga/tests/in/abstract-types-function-calls.param.ron create mode 100644 naga/tests/in/abstract-types-operators.param.ron create mode 100644 naga/tests/in/abstract-types-return.param.ron create mode 100644 naga/tests/in/abstract-types-var.param.ron create mode 100644 naga/tests/in/atomicCompareExchange.param.ron create mode 100644 naga/tests/in/atomicOps.param.ron create mode 100644 naga/tests/in/bitcast.param.ron delete mode 100644 naga/tests/in/bitcast.params.ron create mode 100644 naga/tests/in/break-if.param.ron create mode 100644 naga/tests/in/const-exprs.param.ron create mode 100644 naga/tests/in/const_assert.param.ron create mode 100644 naga/tests/in/cross.param.ron create mode 100644 naga/tests/in/cubeArrayShadow.param.ron create mode 100644 naga/tests/in/fragment-output.param.ron create mode 100644 naga/tests/in/glsl/800-out-of-bounds-panic.param.ron create mode 100644 naga/tests/in/glsl/896-push-constant.param.ron create mode 100644 naga/tests/in/glsl/double-math-functions.param.ron rename naga/tests/in/{variations.glsl => glsl/variations.frag} (100%) create mode 100644 naga/tests/in/glsl/variations.param.ron create mode 100644 naga/tests/in/glsl/vector-functions.param.ron create mode 100644 naga/tests/in/hlsl-keyword.param.ron create mode 100644 naga/tests/in/index-by-value.param.ron create mode 100644 naga/tests/in/lexical-scopes.param.ron create mode 100644 naga/tests/in/module-scope.param.ron create mode 100644 naga/tests/in/msl-varyings.param.ron create mode 100644 naga/tests/in/must-use.param.ron create mode 100644 naga/tests/in/phony_assignment.param.ron delete mode 100644 naga/tests/in/phony_assignment.ron create mode 100644 naga/tests/in/runtime-array-in-unused-struct.param.ron create mode 100644 naga/tests/in/spv/atomic_compare_exchange.param.ron create mode 100644 naga/tests/in/spv/atomic_exchange.param.ron create mode 100644 naga/tests/in/spv/atomic_global_struct_field_vertex.param.ron create mode 100644 naga/tests/in/spv/atomic_i_add_sub.param.ron create mode 100644 naga/tests/in/spv/atomic_i_decrement.param.ron create mode 100644 naga/tests/in/spv/atomic_i_increment.param.ron create mode 100644 naga/tests/in/spv/atomic_load_and_store.param.ron create mode 100644 naga/tests/in/spv/binding-arrays.dynamic.param.ron create mode 100644 naga/tests/in/spv/binding-arrays.static.param.ron create mode 100644 naga/tests/in/spv/builtin-accessed-outside-entrypoint.param.ron create mode 100644 naga/tests/in/spv/degrees.param.ron create mode 100644 naga/tests/in/spv/do-while.param.ron create mode 100644 naga/tests/in/spv/empty-global-name.param.ron create mode 100644 naga/tests/in/spv/fetch_depth.param.ron create mode 100644 naga/tests/in/spv/inv-hyperbolic-trig-functions.param.ron create mode 100644 naga/tests/in/spv/quad-vert.param.ron create mode 100644 naga/tests/in/spv/shadow.param.ron create mode 100644 naga/tests/in/spv/spec-constants-issue-5598.param.ron create mode 100644 naga/tests/in/spv/spec-constants.param.ron create mode 100644 naga/tests/in/spv/unnamed-gl-per-vertex.param.ron create mode 100644 naga/tests/in/storage-textures.param.ron create mode 100644 naga/tests/in/struct-layout.param.ron create mode 100644 naga/tests/in/template-list-ge.param.ron create mode 100644 naga/tests/in/type-alias.param.ron create mode 100644 naga/tests/in/workgroup-uniform-load.param.ron create mode 100644 naga/tests/out/glsl/variations.frag.main.Fragment.glsl diff --git a/naga/tests/in/6220-break-from-loop.param.ron b/naga/tests/in/6220-break-from-loop.param.ron index 72873dd667..52740817bd 100644 --- a/naga/tests/in/6220-break-from-loop.param.ron +++ b/naga/tests/in/6220-break-from-loop.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV", ) diff --git a/naga/tests/in/6438-conflicting-idents.param.ron b/naga/tests/in/6438-conflicting-idents.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/6438-conflicting-idents.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/6772-unpack-expr-accesses.param.ron b/naga/tests/in/6772-unpack-expr-accesses.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/6772-unpack-expr-accesses.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/6772-unpack-expr-accesses.ron b/naga/tests/in/6772-unpack-expr-accesses.ron deleted file mode 100644 index 72873dd667..0000000000 --- a/naga/tests/in/6772-unpack-expr-accesses.ron +++ /dev/null @@ -1,2 +0,0 @@ -( -) diff --git a/naga/tests/in/abstract-types-const.param.ron b/naga/tests/in/abstract-types-const.param.ron new file mode 100644 index 0000000000..41ae91e18f --- /dev/null +++ b/naga/tests/in/abstract-types-const.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | WGSL", +) diff --git a/naga/tests/in/abstract-types-function-calls.param.ron b/naga/tests/in/abstract-types-function-calls.param.ron new file mode 100644 index 0000000000..41ae91e18f --- /dev/null +++ b/naga/tests/in/abstract-types-function-calls.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | WGSL", +) diff --git a/naga/tests/in/abstract-types-operators.param.ron b/naga/tests/in/abstract-types-operators.param.ron new file mode 100644 index 0000000000..41ae91e18f --- /dev/null +++ b/naga/tests/in/abstract-types-operators.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | WGSL", +) diff --git a/naga/tests/in/abstract-types-return.param.ron b/naga/tests/in/abstract-types-return.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/abstract-types-return.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/abstract-types-var.param.ron b/naga/tests/in/abstract-types-var.param.ron new file mode 100644 index 0000000000..41ae91e18f --- /dev/null +++ b/naga/tests/in/abstract-types-var.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | WGSL", +) diff --git a/naga/tests/in/access.param.ron b/naga/tests/in/access.param.ron index e67f90cf2f..e24f9a88f5 100644 --- a/naga/tests/in/access.param.ron +++ b/naga/tests/in/access.param.ron @@ -35,4 +35,5 @@ fake_missing_bindings: false, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL | IR | ANALYSIS", ) diff --git a/naga/tests/in/array-in-ctor.param.ron b/naga/tests/in/array-in-ctor.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/array-in-ctor.param.ron +++ b/naga/tests/in/array-in-ctor.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/array-in-function-return-type.param.ron b/naga/tests/in/array-in-function-return-type.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/array-in-function-return-type.param.ron +++ b/naga/tests/in/array-in-function-return-type.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/atomicCompareExchange-int64.param.ron b/naga/tests/in/atomicCompareExchange-int64.param.ron index c71b9aaa3f..b72ad400e8 100644 --- a/naga/tests/in/atomicCompareExchange-int64.param.ron +++ b/naga/tests/in/atomicCompareExchange-int64.param.ron @@ -13,4 +13,5 @@ zero_initialize_workgroup_memory: true, restrict_indexing: true ), + targets: "SPIRV | WGSL", ) diff --git a/naga/tests/in/atomicCompareExchange.param.ron b/naga/tests/in/atomicCompareExchange.param.ron new file mode 100644 index 0000000000..4fe29b74ac --- /dev/null +++ b/naga/tests/in/atomicCompareExchange.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | WGSL", +) diff --git a/naga/tests/in/atomicOps-float32.param.ron b/naga/tests/in/atomicOps-float32.param.ron index 13919f13ef..e8e3380f0d 100644 --- a/naga/tests/in/atomicOps-float32.param.ron +++ b/naga/tests/in/atomicOps-float32.param.ron @@ -12,4 +12,5 @@ fake_missing_bindings: true, zero_initialize_workgroup_memory: false, ), + targets: "SPIRV | METAL | WGSL", ) diff --git a/naga/tests/in/atomicOps-int64-min-max.param.ron b/naga/tests/in/atomicOps-int64-min-max.param.ron index 1982249206..41a3eb9929 100644 --- a/naga/tests/in/atomicOps-int64-min-max.param.ron +++ b/naga/tests/in/atomicOps-int64-min-max.param.ron @@ -21,4 +21,5 @@ fake_missing_bindings: true, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | HLSL | WGSL", ) diff --git a/naga/tests/in/atomicOps-int64.param.ron b/naga/tests/in/atomicOps-int64.param.ron index c71b9aaa3f..a310394076 100644 --- a/naga/tests/in/atomicOps-int64.param.ron +++ b/naga/tests/in/atomicOps-int64.param.ron @@ -13,4 +13,5 @@ zero_initialize_workgroup_memory: true, restrict_indexing: true ), + targets: "SPIRV | HLSL | WGSL", ) diff --git a/naga/tests/in/atomicOps.param.ron b/naga/tests/in/atomicOps.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/atomicOps.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/atomicTexture-int64.param.ron b/naga/tests/in/atomicTexture-int64.param.ron index ffc7fb4cb7..283227c7a0 100644 --- a/naga/tests/in/atomicTexture-int64.param.ron +++ b/naga/tests/in/atomicTexture-int64.param.ron @@ -21,4 +21,5 @@ fake_missing_bindings: true, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | HLSL | WGSL", ) diff --git a/naga/tests/in/atomicTexture.param.ron b/naga/tests/in/atomicTexture.param.ron index 34f638160d..295a34cc79 100644 --- a/naga/tests/in/atomicTexture.param.ron +++ b/naga/tests/in/atomicTexture.param.ron @@ -27,4 +27,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/binding-arrays.param.ron b/naga/tests/in/binding-arrays.param.ron index 96807d825a..7a7aa6896e 100644 --- a/naga/tests/in/binding-arrays.param.ron +++ b/naga/tests/in/binding-arrays.param.ron @@ -43,5 +43,6 @@ index: ReadZeroSkipWrite, buffer: ReadZeroSkipWrite, image_load: ReadZeroSkipWrite, - ) + ), + targets: "WGSL | HLSL | METAL | SPIRV", ) diff --git a/naga/tests/in/binding-buffer-arrays.param.ron b/naga/tests/in/binding-buffer-arrays.param.ron index 4f653bb21b..cf424fb458 100644 --- a/naga/tests/in/binding-buffer-arrays.param.ron +++ b/naga/tests/in/binding-buffer-arrays.param.ron @@ -10,5 +10,7 @@ index: ReadZeroSkipWrite, buffer: ReadZeroSkipWrite, image: ReadZeroSkipWrite, - ) + ), + //TODO: more backends, eventually merge into "binding-arrays" + targets: "WGSL | SPIRV", ) diff --git a/naga/tests/in/bitcast.param.ron b/naga/tests/in/bitcast.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/bitcast.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/bitcast.params.ron b/naga/tests/in/bitcast.params.ron deleted file mode 100644 index febd505f73..0000000000 --- a/naga/tests/in/bitcast.params.ron +++ /dev/null @@ -1,16 +0,0 @@ -( - msl: ( - lang_version: (1, 0), - per_entry_point_map: { - "main": ( - resources: { - }, - sizes_buffer: Some(0), - ) - }, - inline_samplers: [], - spirv_cross_compatibility: false, - fake_missing_bindings: false, - zero_initialize_workgroup_memory: true, - ), -) diff --git a/naga/tests/in/bits.param.ron b/naga/tests/in/bits.param.ron index b40cf9fa08..1604756a35 100644 --- a/naga/tests/in/bits.param.ron +++ b/naga/tests/in/bits.param.ron @@ -13,4 +13,5 @@ fake_missing_bindings: false, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/boids.param.ron b/naga/tests/in/boids.param.ron index 25f81b8afd..aec8e06859 100644 --- a/naga/tests/in/boids.param.ron +++ b/naga/tests/in/boids.param.ron @@ -21,4 +21,5 @@ fake_missing_bindings: false, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/bounds-check-dynamic-buffer.param.ron b/naga/tests/in/bounds-check-dynamic-buffer.param.ron index 8186d536fe..ea393bbb22 100644 --- a/naga/tests/in/bounds-check-dynamic-buffer.param.ron +++ b/naga/tests/in/bounds-check-dynamic-buffer.param.ron @@ -14,4 +14,5 @@ }, restrict_indexing: true ), -) \ No newline at end of file + targets: "HLSL", +) diff --git a/naga/tests/in/bounds-check-image-restrict.param.ron b/naga/tests/in/bounds-check-image-restrict.param.ron index 19f7399068..5cebe6343c 100644 --- a/naga/tests/in/bounds-check-image-restrict.param.ron +++ b/naga/tests/in/bounds-check-image-restrict.param.ron @@ -20,4 +20,5 @@ fake_missing_bindings: true, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL", ) diff --git a/naga/tests/in/bounds-check-image-rzsw.param.ron b/naga/tests/in/bounds-check-image-rzsw.param.ron index e818d7a3ba..fbf7998a7b 100644 --- a/naga/tests/in/bounds-check-image-rzsw.param.ron +++ b/naga/tests/in/bounds-check-image-rzsw.param.ron @@ -20,4 +20,5 @@ fake_missing_bindings: true, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL", ) diff --git a/naga/tests/in/bounds-check-restrict.param.ron b/naga/tests/in/bounds-check-restrict.param.ron index 93c734c146..36e9e53768 100644 --- a/naga/tests/in/bounds-check-restrict.param.ron +++ b/naga/tests/in/bounds-check-restrict.param.ron @@ -3,4 +3,5 @@ index: Restrict, buffer: Restrict, ), + targets: "SPIRV | METAL", ) diff --git a/naga/tests/in/bounds-check-zero-atomic.param.ron b/naga/tests/in/bounds-check-zero-atomic.param.ron index 3ca0053af1..c39cb6840f 100644 --- a/naga/tests/in/bounds-check-zero-atomic.param.ron +++ b/naga/tests/in/bounds-check-zero-atomic.param.ron @@ -3,4 +3,5 @@ index: ReadZeroSkipWrite, buffer: ReadZeroSkipWrite, ), + targets: "METAL", ) diff --git a/naga/tests/in/bounds-check-zero.param.ron b/naga/tests/in/bounds-check-zero.param.ron index 3ca0053af1..2bdb1e36b2 100644 --- a/naga/tests/in/bounds-check-zero.param.ron +++ b/naga/tests/in/bounds-check-zero.param.ron @@ -3,4 +3,5 @@ index: ReadZeroSkipWrite, buffer: ReadZeroSkipWrite, ), + targets: "SPIRV | METAL", ) diff --git a/naga/tests/in/break-if.param.ron b/naga/tests/in/break-if.param.ron new file mode 100644 index 0000000000..a10b27eabb --- /dev/null +++ b/naga/tests/in/break-if.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL | GLSL | SPIRV | HLSL | METAL", +) diff --git a/naga/tests/in/collatz.param.ron b/naga/tests/in/collatz.param.ron index 5b157849bc..35ee22c49e 100644 --- a/naga/tests/in/collatz.param.ron +++ b/naga/tests/in/collatz.param.ron @@ -3,4 +3,5 @@ version: (1, 0), debug: true, ), + targets: "SPIRV | METAL | IR | ANALYSIS | HLSL | WGSL", ) diff --git a/naga/tests/in/const-exprs.param.ron b/naga/tests/in/const-exprs.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/const-exprs.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/const_assert.param.ron b/naga/tests/in/const_assert.param.ron new file mode 100644 index 0000000000..aaa447a30b --- /dev/null +++ b/naga/tests/in/const_assert.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL | IR", +) diff --git a/naga/tests/in/constructors.param.ron b/naga/tests/in/constructors.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/constructors.param.ron +++ b/naga/tests/in/constructors.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/control-flow.param.ron b/naga/tests/in/control-flow.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/control-flow.param.ron +++ b/naga/tests/in/control-flow.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/cross.param.ron b/naga/tests/in/cross.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/cross.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/cubeArrayShadow.param.ron b/naga/tests/in/cubeArrayShadow.param.ron new file mode 100644 index 0000000000..10b8c634fe --- /dev/null +++ b/naga/tests/in/cubeArrayShadow.param.ron @@ -0,0 +1,3 @@ +( + targets: "GLSL", +) diff --git a/naga/tests/in/debug-symbol-large-source.param.ron b/naga/tests/in/debug-symbol-large-source.param.ron index 2869084cd0..bf414857fa 100644 --- a/naga/tests/in/debug-symbol-large-source.param.ron +++ b/naga/tests/in/debug-symbol-large-source.param.ron @@ -4,4 +4,5 @@ debug: true, adjust_coordinate_space: false, ), -) \ No newline at end of file + targets: "SPIRV", +) diff --git a/naga/tests/in/debug-symbol-simple.param.ron b/naga/tests/in/debug-symbol-simple.param.ron index 2869084cd0..bf414857fa 100644 --- a/naga/tests/in/debug-symbol-simple.param.ron +++ b/naga/tests/in/debug-symbol-simple.param.ron @@ -4,4 +4,5 @@ debug: true, adjust_coordinate_space: false, ), -) \ No newline at end of file + targets: "SPIRV", +) diff --git a/naga/tests/in/debug-symbol-terrain.param.ron b/naga/tests/in/debug-symbol-terrain.param.ron index 2869084cd0..bf414857fa 100644 --- a/naga/tests/in/debug-symbol-terrain.param.ron +++ b/naga/tests/in/debug-symbol-terrain.param.ron @@ -4,4 +4,5 @@ debug: true, adjust_coordinate_space: false, ), -) \ No newline at end of file + targets: "SPIRV", +) diff --git a/naga/tests/in/diagnostic-filter.param.ron b/naga/tests/in/diagnostic-filter.param.ron index 72873dd667..8a613b6a5d 100644 --- a/naga/tests/in/diagnostic-filter.param.ron +++ b/naga/tests/in/diagnostic-filter.param.ron @@ -1,2 +1,3 @@ ( + targets: "IR", ) diff --git a/naga/tests/in/dualsource.param.ron b/naga/tests/in/dualsource.param.ron index 9ab5ee4146..5f4b73b04b 100644 --- a/naga/tests/in/dualsource.param.ron +++ b/naga/tests/in/dualsource.param.ron @@ -8,4 +8,5 @@ fake_missing_bindings: false, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/empty.param.ron b/naga/tests/in/empty.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/empty.param.ron +++ b/naga/tests/in/empty.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/extra.param.ron b/naga/tests/in/extra.param.ron index 581c6d6bdb..d95081fa55 100644 --- a/naga/tests/in/extra.param.ron +++ b/naga/tests/in/extra.param.ron @@ -15,4 +15,5 @@ fake_missing_bindings: false, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | WGSL", ) diff --git a/naga/tests/in/f64.param.ron b/naga/tests/in/f64.param.ron index f1f5359da6..f69308ea91 100644 --- a/naga/tests/in/f64.param.ron +++ b/naga/tests/in/f64.param.ron @@ -9,4 +9,5 @@ binding_map: { }, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/force_point_size_vertex_shader_webgl.param.ron b/naga/tests/in/force_point_size_vertex_shader_webgl.param.ron index c0b7a4d457..8336d9887b 100644 --- a/naga/tests/in/force_point_size_vertex_shader_webgl.param.ron +++ b/naga/tests/in/force_point_size_vertex_shader_webgl.param.ron @@ -8,4 +8,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "GLSL", ) diff --git a/naga/tests/in/fragment-output.param.ron b/naga/tests/in/fragment-output.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/fragment-output.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/functions-webgl.param.ron b/naga/tests/in/functions-webgl.param.ron index ddb54c093c..5edf44e5bc 100644 --- a/naga/tests/in/functions-webgl.param.ron +++ b/naga/tests/in/functions-webgl.param.ron @@ -8,4 +8,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "GLSL", ) diff --git a/naga/tests/in/functions.param.ron b/naga/tests/in/functions.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/functions.param.ron +++ b/naga/tests/in/functions.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/globals.param.ron b/naga/tests/in/globals.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/globals.param.ron +++ b/naga/tests/in/globals.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/glsl/800-out-of-bounds-panic.param.ron b/naga/tests/in/glsl/800-out-of-bounds-panic.param.ron new file mode 100644 index 0000000000..c70ada9939 --- /dev/null +++ b/naga/tests/in/glsl/800-out-of-bounds-panic.param.ron @@ -0,0 +1,3 @@ +( + god_mode: true, +) \ No newline at end of file diff --git a/naga/tests/in/glsl/896-push-constant.param.ron b/naga/tests/in/glsl/896-push-constant.param.ron new file mode 100644 index 0000000000..c70ada9939 --- /dev/null +++ b/naga/tests/in/glsl/896-push-constant.param.ron @@ -0,0 +1,3 @@ +( + god_mode: true, +) \ No newline at end of file diff --git a/naga/tests/in/glsl/double-math-functions.param.ron b/naga/tests/in/glsl/double-math-functions.param.ron new file mode 100644 index 0000000000..c70ada9939 --- /dev/null +++ b/naga/tests/in/glsl/double-math-functions.param.ron @@ -0,0 +1,3 @@ +( + god_mode: true, +) \ No newline at end of file diff --git a/naga/tests/in/variations.glsl b/naga/tests/in/glsl/variations.frag similarity index 100% rename from naga/tests/in/variations.glsl rename to naga/tests/in/glsl/variations.frag diff --git a/naga/tests/in/glsl/variations.param.ron b/naga/tests/in/glsl/variations.param.ron new file mode 100644 index 0000000000..10b8c634fe --- /dev/null +++ b/naga/tests/in/glsl/variations.param.ron @@ -0,0 +1,3 @@ +( + targets: "GLSL", +) diff --git a/naga/tests/in/glsl/vector-functions.param.ron b/naga/tests/in/glsl/vector-functions.param.ron new file mode 100644 index 0000000000..c70ada9939 --- /dev/null +++ b/naga/tests/in/glsl/vector-functions.param.ron @@ -0,0 +1,3 @@ +( + god_mode: true, +) \ No newline at end of file diff --git a/naga/tests/in/hlsl-keyword.param.ron b/naga/tests/in/hlsl-keyword.param.ron new file mode 100644 index 0000000000..a92d1c5b00 --- /dev/null +++ b/naga/tests/in/hlsl-keyword.param.ron @@ -0,0 +1,3 @@ +( + targets: "HLSL", +) diff --git a/naga/tests/in/image.param.ron b/naga/tests/in/image.param.ron index 7f2d247d88..39e7553395 100644 --- a/naga/tests/in/image.param.ron +++ b/naga/tests/in/image.param.ron @@ -9,5 +9,6 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), - glsl_exclude_list: ["depth_load", "depth_no_comparison"] + glsl_exclude_list: ["depth_load", "depth_no_comparison"], + targets: "SPIRV | METAL | HLSL | WGSL | GLSL", ) diff --git a/naga/tests/in/index-by-value.param.ron b/naga/tests/in/index-by-value.param.ron new file mode 100644 index 0000000000..a66141388f --- /dev/null +++ b/naga/tests/in/index-by-value.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | IR", +) diff --git a/naga/tests/in/int64.param.ron b/naga/tests/in/int64.param.ron index 3bb89bce0b..096cbb39e5 100644 --- a/naga/tests/in/int64.param.ron +++ b/naga/tests/in/int64.param.ron @@ -21,4 +21,5 @@ fake_missing_bindings: true, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | HLSL | WGSL | METAL", ) diff --git a/naga/tests/in/interface.param.ron b/naga/tests/in/interface.param.ron index 992046970e..2d90d9345c 100644 --- a/naga/tests/in/interface.param.ron +++ b/naga/tests/in/interface.param.ron @@ -1,4 +1,6 @@ ( + //TODO: GLSL https://github.com/gfx-rs/naga/issues/874 + targets: "SPIRV | METAL | HLSL | WGSL", spv: ( version: (1, 0), capabilities: [ Shader, SampleRateShading ], diff --git a/naga/tests/in/interpolate.param.ron b/naga/tests/in/interpolate.param.ron index b6d629c4ea..8882e0fd39 100644 --- a/naga/tests/in/interpolate.param.ron +++ b/naga/tests/in/interpolate.param.ron @@ -12,4 +12,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | HLSL | WGSL", ) diff --git a/naga/tests/in/interpolate_compat.param.ron b/naga/tests/in/interpolate_compat.param.ron index b6d629c4ea..b990a57c90 100644 --- a/naga/tests/in/interpolate_compat.param.ron +++ b/naga/tests/in/interpolate_compat.param.ron @@ -12,4 +12,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/invariant.param.ron b/naga/tests/in/invariant.param.ron index b622806ad0..12e5f252cf 100644 --- a/naga/tests/in/invariant.param.ron +++ b/naga/tests/in/invariant.param.ron @@ -8,4 +8,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "GLSL", ) diff --git a/naga/tests/in/lexical-scopes.param.ron b/naga/tests/in/lexical-scopes.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/lexical-scopes.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/local-const.param.ron b/naga/tests/in/local-const.param.ron index dd626a0f31..c1d95c49f9 100644 --- a/naga/tests/in/local-const.param.ron +++ b/naga/tests/in/local-const.param.ron @@ -1 +1,3 @@ -() \ No newline at end of file +( + targets: "IR | WGSL", +) diff --git a/naga/tests/in/math-functions.param.ron b/naga/tests/in/math-functions.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/math-functions.param.ron +++ b/naga/tests/in/math-functions.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/module-scope.param.ron b/naga/tests/in/module-scope.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/module-scope.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/msl-varyings.param.ron b/naga/tests/in/msl-varyings.param.ron new file mode 100644 index 0000000000..82556fb9e4 --- /dev/null +++ b/naga/tests/in/msl-varyings.param.ron @@ -0,0 +1,3 @@ +( + targets: "METAL", +) diff --git a/naga/tests/in/multiview.param.ron b/naga/tests/in/multiview.param.ron index 69390f9fd8..8d2e3e2d6c 100644 --- a/naga/tests/in/multiview.param.ron +++ b/naga/tests/in/multiview.param.ron @@ -1,4 +1,5 @@ ( god_mode: true, glsl_multiview: Some(2), + targets: "SPIRV | GLSL | WGSL", ) diff --git a/naga/tests/in/multiview_webgl.param.ron b/naga/tests/in/multiview_webgl.param.ron index bea71aa412..82340764ba 100644 --- a/naga/tests/in/multiview_webgl.param.ron +++ b/naga/tests/in/multiview_webgl.param.ron @@ -10,4 +10,5 @@ zero_initialize_workgroup_memory: true, ), glsl_multiview: Some(2), + targets: "GLSL", ) diff --git a/naga/tests/in/must-use.param.ron b/naga/tests/in/must-use.param.ron new file mode 100644 index 0000000000..8a613b6a5d --- /dev/null +++ b/naga/tests/in/must-use.param.ron @@ -0,0 +1,3 @@ +( + targets: "IR", +) diff --git a/naga/tests/in/operators.param.ron b/naga/tests/in/operators.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/operators.param.ron +++ b/naga/tests/in/operators.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/overrides-atomicCompareExchangeWeak.param.ron b/naga/tests/in/overrides-atomicCompareExchangeWeak.param.ron index ff9c84ac61..4174ec231e 100644 --- a/naga/tests/in/overrides-atomicCompareExchangeWeak.param.ron +++ b/naga/tests/in/overrides-atomicCompareExchangeWeak.param.ron @@ -5,5 +5,6 @@ ), pipeline_constants: { "o": 2.0 - } + }, + targets: "IR | SPIRV | METAL", ) diff --git a/naga/tests/in/overrides-ray-query.param.ron b/naga/tests/in/overrides-ray-query.param.ron index 588656aaac..9a271ee8a0 100644 --- a/naga/tests/in/overrides-ray-query.param.ron +++ b/naga/tests/in/overrides-ray-query.param.ron @@ -14,5 +14,6 @@ ), pipeline_constants: { "o": 2.0 - } + }, + targets: "IR | SPIRV | METAL", ) diff --git a/naga/tests/in/overrides.param.ron b/naga/tests/in/overrides.param.ron index 5c9b72d310..fdb29dcd73 100644 --- a/naga/tests/in/overrides.param.ron +++ b/naga/tests/in/overrides.param.ron @@ -7,5 +7,6 @@ "0": NaN, "1300": 1.1, "depth": 2.3, - } + }, + targets: "IR | ANALYSIS | SPIRV | METAL | HLSL | GLSL", ) diff --git a/naga/tests/in/padding.param.ron b/naga/tests/in/padding.param.ron index 1a735a201e..e2150041a6 100644 --- a/naga/tests/in/padding.param.ron +++ b/naga/tests/in/padding.param.ron @@ -20,4 +20,5 @@ fake_missing_bindings: false, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/phony_assignment.param.ron b/naga/tests/in/phony_assignment.param.ron new file mode 100644 index 0000000000..810d119b86 --- /dev/null +++ b/naga/tests/in/phony_assignment.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/phony_assignment.ron b/naga/tests/in/phony_assignment.ron deleted file mode 100644 index 39679b87b1..0000000000 --- a/naga/tests/in/phony_assignment.ron +++ /dev/null @@ -1,2 +0,0 @@ -( -) \ No newline at end of file diff --git a/naga/tests/in/pointers.param.ron b/naga/tests/in/pointers.param.ron index c3b4d8880b..f0dc198adb 100644 --- a/naga/tests/in/pointers.param.ron +++ b/naga/tests/in/pointers.param.ron @@ -7,4 +7,5 @@ debug: true, adjust_coordinate_space: false, ), + targets: "SPIRV | WGSL", ) diff --git a/naga/tests/in/policy-mix.param.ron b/naga/tests/in/policy-mix.param.ron index 31e80e4c52..0921c49472 100644 --- a/naga/tests/in/policy-mix.param.ron +++ b/naga/tests/in/policy-mix.param.ron @@ -8,4 +8,5 @@ version: (1, 1), debug: true, ), + targets: "SPIRV | METAL", ) diff --git a/naga/tests/in/push-constants.param.ron b/naga/tests/in/push-constants.param.ron index 26e32a9324..e1dba98fb3 100644 --- a/naga/tests/in/push-constants.param.ron +++ b/naga/tests/in/push-constants.param.ron @@ -18,4 +18,5 @@ zero_initialize_workgroup_memory: true, restrict_indexing: true ), + targets: "GLSL | HLSL", ) diff --git a/naga/tests/in/quad.param.ron b/naga/tests/in/quad.param.ron index 7e3f5504db..c701ec8574 100644 --- a/naga/tests/in/quad.param.ron +++ b/naga/tests/in/quad.param.ron @@ -13,4 +13,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "SPIRV | METAL | GLSL | DOT | HLSL | WGSL", ) diff --git a/naga/tests/in/ray-query.param.ron b/naga/tests/in/ray-query.param.ron index 481d311fa4..2c40ef3b15 100644 --- a/naga/tests/in/ray-query.param.ron +++ b/naga/tests/in/ray-query.param.ron @@ -17,5 +17,6 @@ fake_missing_bindings: true, special_constants_binding: None, zero_initialize_workgroup_memory: true, - ) + ), + targets: "SPIRV | METAL | HLSL", ) diff --git a/naga/tests/in/resource-binding-map.param.ron b/naga/tests/in/resource-binding-map.param.ron index a700a33f2a..632ba9759e 100644 --- a/naga/tests/in/resource-binding-map.param.ron +++ b/naga/tests/in/resource-binding-map.param.ron @@ -49,5 +49,6 @@ index: ReadZeroSkipWrite, buffer: ReadZeroSkipWrite, image_load: ReadZeroSkipWrite, - ) + ), + targets: "METAL", ) diff --git a/naga/tests/in/runtime-array-in-unused-struct.param.ron b/naga/tests/in/runtime-array-in-unused-struct.param.ron new file mode 100644 index 0000000000..52740817bd --- /dev/null +++ b/naga/tests/in/runtime-array-in-unused-struct.param.ron @@ -0,0 +1,3 @@ +( + targets: "SPIRV", +) diff --git a/naga/tests/in/sample-cube-array-depth-lod.param.ron b/naga/tests/in/sample-cube-array-depth-lod.param.ron index 8964b53d83..ff6243b368 100644 --- a/naga/tests/in/sample-cube-array-depth-lod.param.ron +++ b/naga/tests/in/sample-cube-array-depth-lod.param.ron @@ -8,4 +8,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "GLSL", ) diff --git a/naga/tests/in/separate-entry-points.param.ron b/naga/tests/in/separate-entry-points.param.ron index af0931c111..4d94219c71 100644 --- a/naga/tests/in/separate-entry-points.param.ron +++ b/naga/tests/in/separate-entry-points.param.ron @@ -3,4 +3,5 @@ version: (1, 0), separate_entry_points: true, ), + targets: "SPIRV | GLSL", ) diff --git a/naga/tests/in/shadow.param.ron b/naga/tests/in/shadow.param.ron index e37f9108ae..110dca48d3 100644 --- a/naga/tests/in/shadow.param.ron +++ b/naga/tests/in/shadow.param.ron @@ -4,4 +4,5 @@ debug: true, adjust_coordinate_space: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/skybox.param.ron b/naga/tests/in/skybox.param.ron index 8e00ed943e..0b7061cc91 100644 --- a/naga/tests/in/skybox.param.ron +++ b/naga/tests/in/skybox.param.ron @@ -64,4 +64,5 @@ zero_initialize_workgroup_memory: true, restrict_indexing: true ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/sprite.param.ron b/naga/tests/in/sprite.param.ron index 08598faeef..7a8020ee7f 100644 --- a/naga/tests/in/sprite.param.ron +++ b/naga/tests/in/sprite.param.ron @@ -2,4 +2,5 @@ spv: ( version: (1, 4), ), + targets: "SPIRV", ) diff --git a/naga/tests/in/spv/atomic_compare_exchange.param.ron b/naga/tests/in/spv/atomic_compare_exchange.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/atomic_compare_exchange.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/atomic_exchange.param.ron b/naga/tests/in/spv/atomic_exchange.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/atomic_exchange.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/atomic_global_struct_field_vertex.param.ron b/naga/tests/in/spv/atomic_global_struct_field_vertex.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/atomic_global_struct_field_vertex.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/atomic_i_add_sub.param.ron b/naga/tests/in/spv/atomic_i_add_sub.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/atomic_i_add_sub.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/atomic_i_decrement.param.ron b/naga/tests/in/spv/atomic_i_decrement.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/atomic_i_decrement.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/atomic_i_increment.param.ron b/naga/tests/in/spv/atomic_i_increment.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/atomic_i_increment.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/atomic_load_and_store.param.ron b/naga/tests/in/spv/atomic_load_and_store.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/atomic_load_and_store.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/binding-arrays.dynamic.param.ron b/naga/tests/in/spv/binding-arrays.dynamic.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/binding-arrays.dynamic.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/binding-arrays.static.param.ron b/naga/tests/in/spv/binding-arrays.static.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/binding-arrays.static.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/builtin-accessed-outside-entrypoint.param.ron b/naga/tests/in/spv/builtin-accessed-outside-entrypoint.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/spv/builtin-accessed-outside-entrypoint.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/spv/degrees.param.ron b/naga/tests/in/spv/degrees.param.ron new file mode 100644 index 0000000000..5f68811c44 --- /dev/null +++ b/naga/tests/in/spv/degrees.param.ron @@ -0,0 +1,3 @@ +( + targets: "", +) diff --git a/naga/tests/in/spv/do-while.param.ron b/naga/tests/in/spv/do-while.param.ron new file mode 100644 index 0000000000..5277fe9f6f --- /dev/null +++ b/naga/tests/in/spv/do-while.param.ron @@ -0,0 +1,3 @@ +( + targets: "METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/spv/empty-global-name.param.ron b/naga/tests/in/spv/empty-global-name.param.ron new file mode 100644 index 0000000000..65729aa2f8 --- /dev/null +++ b/naga/tests/in/spv/empty-global-name.param.ron @@ -0,0 +1,3 @@ +( + targets: "HLSL | WGSL | METAL", +) diff --git a/naga/tests/in/spv/fetch_depth.param.ron b/naga/tests/in/spv/fetch_depth.param.ron new file mode 100644 index 0000000000..22c5d9061b --- /dev/null +++ b/naga/tests/in/spv/fetch_depth.param.ron @@ -0,0 +1,3 @@ +( + targets: "IR | SPIRV | METAL | HLSL | WGSL", +) diff --git a/naga/tests/in/spv/inv-hyperbolic-trig-functions.param.ron b/naga/tests/in/spv/inv-hyperbolic-trig-functions.param.ron new file mode 100644 index 0000000000..6de6dd9078 --- /dev/null +++ b/naga/tests/in/spv/inv-hyperbolic-trig-functions.param.ron @@ -0,0 +1,3 @@ +( + targets: "HLSL | WGSL", +) diff --git a/naga/tests/in/spv/quad-vert.param.ron b/naga/tests/in/spv/quad-vert.param.ron new file mode 100644 index 0000000000..5277fe9f6f --- /dev/null +++ b/naga/tests/in/spv/quad-vert.param.ron @@ -0,0 +1,3 @@ +( + targets: "METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/spv/shadow.param.ron b/naga/tests/in/spv/shadow.param.ron new file mode 100644 index 0000000000..481e239aa3 --- /dev/null +++ b/naga/tests/in/spv/shadow.param.ron @@ -0,0 +1,3 @@ +( + targets: "IR | ANALYSIS", +) diff --git a/naga/tests/in/spv/spec-constants-issue-5598.param.ron b/naga/tests/in/spv/spec-constants-issue-5598.param.ron new file mode 100644 index 0000000000..10b8c634fe --- /dev/null +++ b/naga/tests/in/spv/spec-constants-issue-5598.param.ron @@ -0,0 +1,3 @@ +( + targets: "GLSL", +) diff --git a/naga/tests/in/spv/spec-constants.param.ron b/naga/tests/in/spv/spec-constants.param.ron new file mode 100644 index 0000000000..8a613b6a5d --- /dev/null +++ b/naga/tests/in/spv/spec-constants.param.ron @@ -0,0 +1,3 @@ +( + targets: "IR", +) diff --git a/naga/tests/in/spv/subgroup-operations-s.param.ron b/naga/tests/in/spv/subgroup-operations-s.param.ron index 32b449720a..4dba664ab9 100644 --- a/naga/tests/in/spv/subgroup-operations-s.param.ron +++ b/naga/tests/in/spv/subgroup-operations-s.param.ron @@ -1,4 +1,5 @@ ( + targets: "METAL | GLSL | HLSL | WGSL", god_mode: true, spv: ( version: (1, 3), diff --git a/naga/tests/in/spv/unnamed-gl-per-vertex.param.ron b/naga/tests/in/spv/unnamed-gl-per-vertex.param.ron new file mode 100644 index 0000000000..5277fe9f6f --- /dev/null +++ b/naga/tests/in/spv/unnamed-gl-per-vertex.param.ron @@ -0,0 +1,3 @@ +( + targets: "METAL | GLSL | HLSL | WGSL", +) diff --git a/naga/tests/in/standard.param.ron b/naga/tests/in/standard.param.ron index 72873dd667..810d119b86 100644 --- a/naga/tests/in/standard.param.ron +++ b/naga/tests/in/standard.param.ron @@ -1,2 +1,3 @@ ( + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/storage-textures.param.ron b/naga/tests/in/storage-textures.param.ron new file mode 100644 index 0000000000..995cf878ca --- /dev/null +++ b/naga/tests/in/storage-textures.param.ron @@ -0,0 +1,3 @@ +( + targets: "IR | ANALYSIS | SPIRV | METAL | HLSL", +) diff --git a/naga/tests/in/struct-layout.param.ron b/naga/tests/in/struct-layout.param.ron new file mode 100644 index 0000000000..a10b27eabb --- /dev/null +++ b/naga/tests/in/struct-layout.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL | GLSL | SPIRV | HLSL | METAL", +) diff --git a/naga/tests/in/subgroup-operations.param.ron b/naga/tests/in/subgroup-operations.param.ron index 32b449720a..4a680e9aa8 100644 --- a/naga/tests/in/subgroup-operations.param.ron +++ b/naga/tests/in/subgroup-operations.param.ron @@ -25,4 +25,5 @@ zero_initialize_workgroup_memory: true, restrict_indexing: true ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/template-list-ge.param.ron b/naga/tests/in/template-list-ge.param.ron new file mode 100644 index 0000000000..a31912e4a7 --- /dev/null +++ b/naga/tests/in/template-list-ge.param.ron @@ -0,0 +1,3 @@ +( + targets: "", +) \ No newline at end of file diff --git a/naga/tests/in/texture-arg.param.ron b/naga/tests/in/texture-arg.param.ron index 4fc2cfe566..46e3b15c34 100644 --- a/naga/tests/in/texture-arg.param.ron +++ b/naga/tests/in/texture-arg.param.ron @@ -4,4 +4,5 @@ debug: true, adjust_coordinate_space: true, ), + targets: "SPIRV | METAL | GLSL | HLSL | WGSL", ) diff --git a/naga/tests/in/type-alias.param.ron b/naga/tests/in/type-alias.param.ron new file mode 100644 index 0000000000..5b9668558e --- /dev/null +++ b/naga/tests/in/type-alias.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL", +) diff --git a/naga/tests/in/unconsumed_vertex_outputs_frag.param.ron b/naga/tests/in/unconsumed_vertex_outputs_frag.param.ron index 72873dd667..a92d1c5b00 100644 --- a/naga/tests/in/unconsumed_vertex_outputs_frag.param.ron +++ b/naga/tests/in/unconsumed_vertex_outputs_frag.param.ron @@ -1,2 +1,3 @@ ( + targets: "HLSL", ) diff --git a/naga/tests/in/unconsumed_vertex_outputs_vert.param.ron b/naga/tests/in/unconsumed_vertex_outputs_vert.param.ron index 72873dd667..398f6bc645 100644 --- a/naga/tests/in/unconsumed_vertex_outputs_vert.param.ron +++ b/naga/tests/in/unconsumed_vertex_outputs_vert.param.ron @@ -1,2 +1,7 @@ ( + targets: "HLSL", + fragment_module: Some(FragmentModule( + path: "unconsumed_vertex_outputs_frag.wgsl", + entry_point: "fs_main" + )), ) diff --git a/naga/tests/in/use-gl-ext-over-grad-workaround-if-instructed.param.ron b/naga/tests/in/use-gl-ext-over-grad-workaround-if-instructed.param.ron index 8964b53d83..ff6243b368 100644 --- a/naga/tests/in/use-gl-ext-over-grad-workaround-if-instructed.param.ron +++ b/naga/tests/in/use-gl-ext-over-grad-workaround-if-instructed.param.ron @@ -8,4 +8,5 @@ binding_map: {}, zero_initialize_workgroup_memory: true, ), + targets: "GLSL", ) diff --git a/naga/tests/in/vertex-pulling-transform.param.ron b/naga/tests/in/vertex-pulling-transform.param.ron index d05e212562..c337314ca1 100644 --- a/naga/tests/in/vertex-pulling-transform.param.ron +++ b/naga/tests/in/vertex-pulling-transform.param.ron @@ -28,4 +28,5 @@ )], )], ), + targets: "METAL", ) diff --git a/naga/tests/in/workgroup-uniform-load.param.ron b/naga/tests/in/workgroup-uniform-load.param.ron new file mode 100644 index 0000000000..a10b27eabb --- /dev/null +++ b/naga/tests/in/workgroup-uniform-load.param.ron @@ -0,0 +1,3 @@ +( + targets: "WGSL | GLSL | SPIRV | HLSL | METAL", +) diff --git a/naga/tests/in/workgroup-var-init.param.ron b/naga/tests/in/workgroup-var-init.param.ron index a00ecf6bfd..15c99d2a28 100644 --- a/naga/tests/in/workgroup-var-init.param.ron +++ b/naga/tests/in/workgroup-var-init.param.ron @@ -19,4 +19,5 @@ fake_missing_bindings: false, zero_initialize_workgroup_memory: true, ), + targets: "WGSL | GLSL | SPIRV | HLSL | METAL", ) diff --git a/naga/tests/out/glsl/variations.frag.main.Fragment.glsl b/naga/tests/out/glsl/variations.frag.main.Fragment.glsl new file mode 100644 index 0000000000..25b258987c --- /dev/null +++ b/naga/tests/out/glsl/variations.frag.main.Fragment.glsl @@ -0,0 +1,20 @@ +#version 310 es + +precision highp float; +precision highp int; + +uniform highp samplerCube _group_0_binding_0_fs; + + +void main_1() { + ivec2 sizeCube = ivec2(0); + float a = 1.0; + sizeCube = ivec2(uvec2(textureSize(_group_0_binding_0_fs, 0).xy)); + return; +} + +void main() { + main_1(); + return; +} + diff --git a/naga/tests/out/spv/access.spvasm b/naga/tests/out/spv/access.spvasm index 1e446bd9c5..b3ddf704e7 100644 --- a/naga/tests/out/spv/access.spvasm +++ b/naga/tests/out/spv/access.spvasm @@ -1,637 +1,1068 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 402 +; Bound: 403 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %311 "foo_vert" %306 %309 -OpEntryPoint Fragment %363 "foo_frag" %362 -OpEntryPoint GLCompute %381 "assign_through_ptr" -OpEntryPoint GLCompute %392 "assign_to_ptr_components" -OpExecutionMode %363 OriginUpperLeft -OpExecutionMode %381 LocalSize 1 1 1 -OpExecutionMode %392 LocalSize 1 1 1 -OpMemberName %6 0 "a" -OpMemberName %6 1 "b" -OpMemberName %6 2 "c" -OpName %6 "GlobalConst" -OpMemberName %7 0 "value" -OpName %7 "AlignedWrapper" -OpMemberName %20 0 "_matrix" -OpMemberName %20 1 "matrix_array" -OpMemberName %20 2 "atom" -OpMemberName %20 3 "atom_arr" -OpMemberName %20 4 "arr" -OpMemberName %20 5 "data" -OpName %20 "Bar" -OpMemberName %22 0 "m" -OpName %22 "Baz" -OpMemberName %26 0 "am" -OpName %26 "MatCx2InArray" -OpMemberName %36 0 "x" -OpName %36 "AssignToMember" -OpMemberName %44 0 "m" -OpName %44 "S" -OpMemberName %45 0 "delicious" -OpName %45 "Inner" -OpMemberName %46 0 "om_nom_nom" -OpMemberName %46 1 "thing" -OpName %46 "Outer" -OpName %51 "global_const" -OpName %53 "bar" -OpName %55 "baz" -OpName %58 "qux" -OpName %61 "nested_mat_cx2" -OpName %65 "test_matrix_within_struct_accesses" -OpName %93 "idx" -OpName %95 "t" -OpName %140 "test_matrix_within_array_within_struct_accesses" -OpName %150 "idx" -OpName %151 "t" -OpName %197 "foo" -OpName %198 "read_from_private" -OpName %203 "a" -OpName %204 "test_arr_as_arg" -OpName %210 "p" -OpName %211 "assign_through_ptr_fn" -OpName %216 "foo" -OpName %217 "assign_array_through_ptr_fn" -OpName %224 "p" -OpName %225 "fetch_arg_ptr_member" -OpName %231 "p" -OpName %232 "assign_to_arg_ptr_member" -OpName %237 "p" -OpName %238 "fetch_arg_ptr_array_element" -OpName %244 "p" -OpName %245 "assign_to_arg_ptr_array_element" -OpName %250 "value" -OpName %251 "index_ptr" -OpName %253 "a" -OpName %262 "member_ptr" -OpName %266 "s" -OpName %272 "let_members_of_members" -OpName %284 "var_members_of_members" -OpName %285 "thing" -OpName %287 "inner" -OpName %290 "delishus" -OpName %306 "vi" -OpName %311 "foo_vert" -OpName %322 "foo" -OpName %323 "c2" -OpName %363 "foo_frag" -OpName %381 "assign_through_ptr" -OpName %386 "val" -OpName %387 "arr" -OpName %392 "assign_to_ptr_components" -OpName %393 "s1" -OpName %395 "a1" -OpMemberDecorate %6 0 Offset 0 -OpMemberDecorate %6 1 Offset 16 -OpMemberDecorate %6 2 Offset 28 +OpEntryPoint Vertex %312 "foo_vert" %307 %310 +OpEntryPoint Fragment %364 "foo_frag" %363 +OpEntryPoint GLCompute %382 "assign_through_ptr" +OpEntryPoint GLCompute %393 "assign_to_ptr_components" +OpExecutionMode %364 OriginUpperLeft +OpExecutionMode %382 LocalSize 1 1 1 +OpExecutionMode %393 LocalSize 1 1 1 +%3 = OpString "access.wgsl" +OpSource Unknown 0 %3 "// This snapshot tests accessing various containers, dereferencing pointers. + +struct GlobalConst { + a: u32, + b: vec3, + c: i32, +} +// tests msl padding insertion for global constants +var global_const: GlobalConst = GlobalConst(0u, vec3(0u, 0u, 0u), 0); + +struct AlignedWrapper { +\t@align(8) value: i32 +} + +struct Bar { +\t_matrix: mat4x3, +\tmatrix_array: array, 2>, +\tatom: atomic, +\tatom_arr: array, 10>, +\tarr: array, 2>, +\tdata: array, +} + +@group(0) @binding(0) +var bar: Bar; + +struct Baz { +\tm: mat3x2, +} + +@group(0) @binding(1) +var baz: Baz; + +@group(0) @binding(2) +var qux: vec2; + +fn test_matrix_within_struct_accesses() { +\tvar idx = 1; + + idx--; + +\t// loads + let l0 = baz.m; + let l1 = baz.m[0]; + let l2 = baz.m[idx]; + let l3 = baz.m[0][1]; + let l4 = baz.m[0][idx]; + let l5 = baz.m[idx][1]; + let l6 = baz.m[idx][idx]; + + var t = Baz(mat3x2(vec2(1.0), vec2(2.0), vec2(3.0))); + + idx++; + +\t// stores + t.m = mat3x2(vec2(6.0), vec2(5.0), vec2(4.0)); + t.m[0] = vec2(9.0); + t.m[idx] = vec2(90.0); + t.m[0][1] = 10.0; + t.m[0][idx] = 20.0; + t.m[idx][1] = 30.0; + t.m[idx][idx] = 40.0; +} + +struct MatCx2InArray { +\tam: array, 2>, +} + +@group(0) @binding(3) +var nested_mat_cx2: MatCx2InArray; + +fn test_matrix_within_array_within_struct_accesses() { +\tvar idx = 1; + + idx--; + +\t// loads + let l0 = nested_mat_cx2.am; + let l1 = nested_mat_cx2.am[0]; + let l2 = nested_mat_cx2.am[0][0]; + let l3 = nested_mat_cx2.am[0][idx]; + let l4 = nested_mat_cx2.am[0][0][1]; + let l5 = nested_mat_cx2.am[0][0][idx]; + let l6 = nested_mat_cx2.am[0][idx][1]; + let l7 = nested_mat_cx2.am[0][idx][idx]; + + var t = MatCx2InArray(array, 2>()); + + idx++; + +\t// stores + t.am = array, 2>(); + t.am[0] = mat4x2(vec2(8.0), vec2(7.0), vec2(6.0), vec2(5.0)); + t.am[0][0] = vec2(9.0); + t.am[0][idx] = vec2(90.0); + t.am[0][0][1] = 10.0; + t.am[0][0][idx] = 20.0; + t.am[0][idx][1] = 30.0; + t.am[0][idx][idx] = 40.0; +} + +fn read_from_private(foo: ptr) -> f32 { + return *foo; +} + +fn test_arr_as_arg(a: array, 5>) -> f32 { + return a[4][9]; +} + +@vertex +fn foo_vert(@builtin(vertex_index) vi: u32) -> @builtin(position) vec4 { + var foo: f32 = 0.0; + // We should check that backed doesn't skip this expression + let baz: f32 = foo; + foo = 1.0; + +\ttest_matrix_within_struct_accesses(); +\ttest_matrix_within_array_within_struct_accesses(); + + // test storage loads +\tlet _matrix = bar._matrix; +\tlet arr = bar.arr; +\tlet index = 3u; +\tlet b = bar._matrix[index].x; +\tlet a = bar.data[arrayLength(&bar.data) - 2u].value; +\tlet c = qux; + +\t// test pointer types +\tlet data_pointer: ptr = &bar.data[0].value; +\tlet foo_value = read_from_private(&foo); + +\t// test array indexing +\tvar c2 = array(a, i32(b), 3, 4, 5); +\tc2[vi + 1u] = 42; +\tlet value = c2[vi]; + +\ttest_arr_as_arg(array, 5>()); + +\treturn vec4(_matrix * vec4(vec4(value)), 2.0); +} + +@fragment +fn foo_frag() -> @location(0) vec4 { +\t// test storage stores +\tbar._matrix[1].z = 1.0; +\tbar._matrix = mat4x3(vec3(0.0), vec3(1.0), vec3(2.0), vec3(3.0)); +\tbar.arr = array, 2>(vec2(0u), vec2(1u)); +\tbar.data[1].value = 1; +\tqux = vec2(); + +\treturn vec4(0.0); +} + +fn assign_through_ptr_fn(p: ptr) { + *p = 42u; +} + +fn assign_array_through_ptr_fn(foo: ptr, 2>>) { + *foo = array, 2>(vec4(1.0), vec4(2.0)); +} + +@compute @workgroup_size(1) +fn assign_through_ptr() { + var val = 33u; + assign_through_ptr_fn(&val); + +\tvar arr = array, 2>(vec4(6.0), vec4(7.0)); + assign_array_through_ptr_fn(&arr); +} + +struct AssignToMember { + x: u32, +} + +fn fetch_arg_ptr_member(p: ptr) -> u32 { + return (*p).x; +} + +fn assign_to_arg_ptr_member(p: ptr) { + (*p).x = 10u; +} + +fn fetch_arg_ptr_array_element(p: ptr>) -> u32 { + return (*p)[1]; +} + +fn assign_to_arg_ptr_array_element(p: ptr>) { + (*p)[1] = 10u; +} + +@compute @workgroup_size(1) +fn assign_to_ptr_components() { + var s1: AssignToMember; + assign_to_arg_ptr_member(&s1); + fetch_arg_ptr_member(&s1); + + var a1: array; + assign_to_arg_ptr_array_element(&a1); + fetch_arg_ptr_array_element(&a1); +} + +fn index_ptr(value: bool) -> bool { + var a = array(value); + let p = &a; + return p[0]; +} + +struct S { m: i32 }; + +fn member_ptr() -> i32 { + var s: S = S(42); + let p = &s; + return p.m; +} + +struct Inner { delicious: i32 } + +struct Outer { om_nom_nom: Inner, thing: u32 } + +fn let_members_of_members() -> i32 { + let thing = Outer(); + + let inner = thing.om_nom_nom; + let delishus = inner.delicious; + + if (thing.thing != u32(delishus)) { + // LOL + } + + return thing.om_nom_nom.delicious; +} + +fn var_members_of_members() -> i32 { + var thing = Outer(); + + var inner = thing.om_nom_nom; + var delishus = inner.delicious; + + if (thing.thing != u32(delishus)) { + // LOL + } + + return thing.om_nom_nom.delicious; +} +" +OpMemberName %7 0 "a" +OpMemberName %7 1 "b" +OpMemberName %7 2 "c" +OpName %7 "GlobalConst" +OpMemberName %8 0 "value" +OpName %8 "AlignedWrapper" +OpMemberName %21 0 "_matrix" +OpMemberName %21 1 "matrix_array" +OpMemberName %21 2 "atom" +OpMemberName %21 3 "atom_arr" +OpMemberName %21 4 "arr" +OpMemberName %21 5 "data" +OpName %21 "Bar" +OpMemberName %23 0 "m" +OpName %23 "Baz" +OpMemberName %27 0 "am" +OpName %27 "MatCx2InArray" +OpMemberName %37 0 "x" +OpName %37 "AssignToMember" +OpMemberName %45 0 "m" +OpName %45 "S" +OpMemberName %46 0 "delicious" +OpName %46 "Inner" +OpMemberName %47 0 "om_nom_nom" +OpMemberName %47 1 "thing" +OpName %47 "Outer" +OpName %52 "global_const" +OpName %54 "bar" +OpName %56 "baz" +OpName %59 "qux" +OpName %62 "nested_mat_cx2" +OpName %66 "test_matrix_within_struct_accesses" +OpName %94 "idx" +OpName %96 "t" +OpName %141 "test_matrix_within_array_within_struct_accesses" +OpName %151 "idx" +OpName %152 "t" +OpName %198 "foo" +OpName %199 "read_from_private" +OpName %204 "a" +OpName %205 "test_arr_as_arg" +OpName %211 "p" +OpName %212 "assign_through_ptr_fn" +OpName %217 "foo" +OpName %218 "assign_array_through_ptr_fn" +OpName %225 "p" +OpName %226 "fetch_arg_ptr_member" +OpName %232 "p" +OpName %233 "assign_to_arg_ptr_member" +OpName %238 "p" +OpName %239 "fetch_arg_ptr_array_element" +OpName %245 "p" +OpName %246 "assign_to_arg_ptr_array_element" +OpName %251 "value" +OpName %252 "index_ptr" +OpName %254 "a" +OpName %263 "member_ptr" +OpName %267 "s" +OpName %273 "let_members_of_members" +OpName %285 "var_members_of_members" +OpName %286 "thing" +OpName %288 "inner" +OpName %291 "delishus" +OpName %307 "vi" +OpName %312 "foo_vert" +OpName %323 "foo" +OpName %324 "c2" +OpName %364 "foo_frag" +OpName %382 "assign_through_ptr" +OpName %387 "val" +OpName %388 "arr" +OpName %393 "assign_to_ptr_components" +OpName %394 "s1" +OpName %396 "a1" OpMemberDecorate %7 0 Offset 0 -OpDecorate %13 ArrayStride 16 -OpDecorate %15 ArrayStride 4 -OpDecorate %18 ArrayStride 8 +OpMemberDecorate %7 1 Offset 16 +OpMemberDecorate %7 2 Offset 28 +OpMemberDecorate %8 0 Offset 0 +OpDecorate %14 ArrayStride 16 +OpDecorate %16 ArrayStride 4 OpDecorate %19 ArrayStride 8 -OpMemberDecorate %20 0 Offset 0 -OpMemberDecorate %20 0 ColMajor -OpMemberDecorate %20 0 MatrixStride 16 -OpMemberDecorate %20 1 Offset 64 -OpMemberDecorate %20 1 ColMajor -OpMemberDecorate %20 1 MatrixStride 8 -OpMemberDecorate %20 2 Offset 96 -OpMemberDecorate %20 3 Offset 100 -OpMemberDecorate %20 4 Offset 144 -OpMemberDecorate %20 5 Offset 160 -OpDecorate %20 Block -OpMemberDecorate %22 0 Offset 0 -OpMemberDecorate %22 0 ColMajor -OpMemberDecorate %22 0 MatrixStride 8 -OpDecorate %25 ArrayStride 32 -OpMemberDecorate %26 0 Offset 0 -OpMemberDecorate %26 0 ColMajor -OpMemberDecorate %26 0 MatrixStride 8 -OpDecorate %28 ArrayStride 4 -OpDecorate %29 ArrayStride 40 -OpDecorate %32 ArrayStride 4 -OpDecorate %34 ArrayStride 16 -OpMemberDecorate %36 0 Offset 0 -OpDecorate %38 ArrayStride 4 -OpDecorate %42 ArrayStride 1 -OpMemberDecorate %44 0 Offset 0 +OpDecorate %20 ArrayStride 8 +OpMemberDecorate %21 0 Offset 0 +OpMemberDecorate %21 0 ColMajor +OpMemberDecorate %21 0 MatrixStride 16 +OpMemberDecorate %21 1 Offset 64 +OpMemberDecorate %21 1 ColMajor +OpMemberDecorate %21 1 MatrixStride 8 +OpMemberDecorate %21 2 Offset 96 +OpMemberDecorate %21 3 Offset 100 +OpMemberDecorate %21 4 Offset 144 +OpMemberDecorate %21 5 Offset 160 +OpDecorate %21 Block +OpMemberDecorate %23 0 Offset 0 +OpMemberDecorate %23 0 ColMajor +OpMemberDecorate %23 0 MatrixStride 8 +OpDecorate %26 ArrayStride 32 +OpMemberDecorate %27 0 Offset 0 +OpMemberDecorate %27 0 ColMajor +OpMemberDecorate %27 0 MatrixStride 8 +OpDecorate %29 ArrayStride 4 +OpDecorate %30 ArrayStride 40 +OpDecorate %33 ArrayStride 4 +OpDecorate %35 ArrayStride 16 +OpMemberDecorate %37 0 Offset 0 +OpDecorate %39 ArrayStride 4 +OpDecorate %43 ArrayStride 1 OpMemberDecorate %45 0 Offset 0 OpMemberDecorate %46 0 Offset 0 -OpMemberDecorate %46 1 Offset 4 -OpDecorate %53 DescriptorSet 0 -OpDecorate %53 Binding 0 -OpDecorate %55 DescriptorSet 0 -OpDecorate %55 Binding 1 -OpDecorate %56 Block -OpMemberDecorate %56 0 Offset 0 -OpDecorate %58 DescriptorSet 0 -OpDecorate %58 Binding 2 -OpDecorate %59 Block -OpMemberDecorate %59 0 Offset 0 -OpDecorate %61 DescriptorSet 0 -OpDecorate %61 Binding 3 -OpDecorate %62 Block -OpMemberDecorate %62 0 Offset 0 -OpDecorate %306 BuiltIn VertexIndex -OpDecorate %309 BuiltIn Position -OpDecorate %362 Location 0 +OpMemberDecorate %47 0 Offset 0 +OpMemberDecorate %47 1 Offset 4 +OpDecorate %54 DescriptorSet 0 +OpDecorate %54 Binding 0 +OpDecorate %56 DescriptorSet 0 +OpDecorate %56 Binding 1 +OpDecorate %57 Block +OpMemberDecorate %57 0 Offset 0 +OpDecorate %59 DescriptorSet 0 +OpDecorate %59 Binding 2 +OpDecorate %60 Block +OpMemberDecorate %60 0 Offset 0 +OpDecorate %62 DescriptorSet 0 +OpDecorate %62 Binding 3 +OpDecorate %63 Block +OpMemberDecorate %63 0 Offset 0 +OpDecorate %307 BuiltIn VertexIndex +OpDecorate %310 BuiltIn Position +OpDecorate %363 Location 0 %2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%4 = OpTypeVector %3 3 -%5 = OpTypeInt 32 1 -%6 = OpTypeStruct %3 %4 %5 -%7 = OpTypeStruct %5 -%8 = OpTypeFloat 32 -%10 = OpTypeVector %8 3 -%9 = OpTypeMatrix %10 4 -%12 = OpTypeVector %8 2 -%11 = OpTypeMatrix %12 2 -%14 = OpConstant %3 2 -%13 = OpTypeArray %11 %14 -%16 = OpConstant %3 10 -%15 = OpTypeArray %5 %16 -%17 = OpTypeVector %3 2 -%18 = OpTypeArray %17 %14 -%19 = OpTypeRuntimeArray %7 -%20 = OpTypeStruct %9 %13 %5 %15 %18 %19 -%21 = OpTypeMatrix %12 3 -%22 = OpTypeStruct %21 -%23 = OpTypeVector %5 2 -%24 = OpTypeMatrix %12 4 -%25 = OpTypeArray %24 %14 -%26 = OpTypeStruct %25 -%27 = OpTypePointer Function %8 -%28 = OpTypeArray %8 %16 -%30 = OpConstant %3 5 -%29 = OpTypeArray %28 %30 -%31 = OpTypeVector %8 4 -%32 = OpTypeArray %5 %30 -%33 = OpTypePointer Function %3 -%34 = OpTypeArray %31 %14 -%35 = OpTypePointer Function %34 -%36 = OpTypeStruct %3 -%37 = OpTypePointer Function %36 -%39 = OpConstant %3 4 -%38 = OpTypeArray %3 %39 -%40 = OpTypePointer Function %38 -%41 = OpTypeBool -%43 = OpConstant %3 1 -%42 = OpTypeArray %41 %43 -%44 = OpTypeStruct %5 -%45 = OpTypeStruct %5 -%46 = OpTypeStruct %45 %3 -%47 = OpConstant %3 0 -%48 = OpConstantComposite %4 %47 %47 %47 -%49 = OpConstant %5 0 -%50 = OpConstantComposite %6 %47 %48 %49 -%52 = OpTypePointer Private %6 -%51 = OpVariable %52 Private %50 -%54 = OpTypePointer StorageBuffer %20 -%53 = OpVariable %54 StorageBuffer -%56 = OpTypeStruct %22 -%57 = OpTypePointer Uniform %56 -%55 = OpVariable %57 Uniform -%59 = OpTypeStruct %23 -%60 = OpTypePointer StorageBuffer %59 -%58 = OpVariable %60 StorageBuffer -%62 = OpTypeStruct %26 -%63 = OpTypePointer Uniform %62 -%61 = OpVariable %63 Uniform -%66 = OpTypeFunction %2 -%67 = OpTypePointer Uniform %22 -%69 = OpConstant %5 1 -%70 = OpConstant %8 1.0 -%71 = OpConstantComposite %12 %70 %70 -%72 = OpConstant %8 2.0 -%73 = OpConstantComposite %12 %72 %72 -%74 = OpConstant %8 3.0 -%75 = OpConstantComposite %12 %74 %74 -%76 = OpConstantComposite %21 %71 %73 %75 -%77 = OpConstantComposite %22 %76 -%78 = OpConstant %8 6.0 -%79 = OpConstantComposite %12 %78 %78 -%80 = OpConstant %8 5.0 -%81 = OpConstantComposite %12 %80 %80 -%82 = OpConstant %8 4.0 -%83 = OpConstantComposite %12 %82 %82 -%84 = OpConstantComposite %21 %79 %81 %83 -%85 = OpConstant %8 9.0 -%86 = OpConstantComposite %12 %85 %85 -%87 = OpConstant %8 90.0 -%88 = OpConstantComposite %12 %87 %87 -%89 = OpConstant %8 10.0 -%90 = OpConstant %8 20.0 -%91 = OpConstant %8 30.0 -%92 = OpConstant %8 40.0 -%94 = OpTypePointer Function %5 -%96 = OpTypePointer Function %22 -%100 = OpTypePointer Uniform %21 -%103 = OpTypePointer Uniform %12 -%109 = OpTypePointer Uniform %8 -%124 = OpTypePointer Function %21 -%126 = OpTypePointer Function %12 -%130 = OpTypePointer Function %8 -%141 = OpTypePointer Uniform %26 -%143 = OpConstantNull %25 -%144 = OpConstantComposite %26 %143 -%145 = OpConstant %8 8.0 -%146 = OpConstantComposite %12 %145 %145 -%147 = OpConstant %8 7.0 -%148 = OpConstantComposite %12 %147 %147 -%149 = OpConstantComposite %24 %146 %148 %79 %81 -%152 = OpTypePointer Function %26 -%156 = OpTypePointer Uniform %25 -%159 = OpTypePointer Uniform %24 -%181 = OpTypePointer Function %25 -%183 = OpTypePointer Function %24 -%199 = OpTypeFunction %8 %27 -%205 = OpTypeFunction %8 %29 -%212 = OpTypeFunction %2 %33 -%213 = OpConstant %3 42 -%218 = OpTypeFunction %2 %35 -%219 = OpConstantComposite %31 %70 %70 %70 %70 -%220 = OpConstantComposite %31 %72 %72 %72 %72 -%221 = OpConstantComposite %34 %219 %220 -%226 = OpTypeFunction %3 %37 -%233 = OpTypeFunction %2 %37 -%239 = OpTypeFunction %3 %40 -%246 = OpTypeFunction %2 %40 -%252 = OpTypeFunction %41 %41 -%254 = OpTypePointer Function %42 -%255 = OpConstantNull %42 -%258 = OpTypePointer Function %41 -%263 = OpTypeFunction %5 -%264 = OpConstant %5 42 -%265 = OpConstantComposite %44 %264 -%267 = OpTypePointer Function %44 -%273 = OpConstantNull %46 -%286 = OpTypePointer Function %46 -%288 = OpTypePointer Function %45 -%289 = OpConstantNull %45 -%291 = OpConstantNull %5 -%307 = OpTypePointer Input %3 -%306 = OpVariable %307 Input -%310 = OpTypePointer Output %31 -%309 = OpVariable %310 Output -%313 = OpTypePointer StorageBuffer %23 -%316 = OpConstant %8 0.0 -%317 = OpConstant %3 3 -%318 = OpConstant %5 3 -%319 = OpConstant %5 4 -%320 = OpConstant %5 5 -%321 = OpConstantNull %29 -%324 = OpTypePointer Function %32 -%325 = OpConstantNull %32 -%330 = OpTypePointer StorageBuffer %9 -%333 = OpTypePointer StorageBuffer %18 -%336 = OpTypePointer StorageBuffer %10 -%337 = OpTypePointer StorageBuffer %8 -%340 = OpTypePointer StorageBuffer %19 -%343 = OpTypePointer StorageBuffer %7 -%344 = OpTypePointer StorageBuffer %5 -%356 = OpTypeVector %5 4 -%362 = OpVariable %310 Output -%365 = OpConstantComposite %10 %316 %316 %316 -%366 = OpConstantComposite %10 %70 %70 %70 -%367 = OpConstantComposite %10 %72 %72 %72 -%368 = OpConstantComposite %10 %74 %74 %74 -%369 = OpConstantComposite %9 %365 %366 %367 %368 -%370 = OpConstantComposite %17 %47 %47 -%371 = OpConstantComposite %17 %43 %43 -%372 = OpConstantComposite %18 %370 %371 -%373 = OpConstantNull %23 -%374 = OpConstantComposite %31 %316 %316 %316 %316 -%382 = OpConstant %3 33 -%383 = OpConstantComposite %31 %78 %78 %78 %78 -%384 = OpConstantComposite %31 %147 %147 %147 %147 -%385 = OpConstantComposite %34 %383 %384 -%394 = OpConstantNull %36 -%396 = OpConstantNull %38 -%65 = OpFunction %2 None %66 -%64 = OpLabel -%93 = OpVariable %94 Function %69 -%95 = OpVariable %96 Function %77 -%68 = OpAccessChain %67 %55 %47 -OpBranch %97 -%97 = OpLabel -%98 = OpLoad %5 %93 -%99 = OpISub %5 %98 %69 -OpStore %93 %99 -%101 = OpAccessChain %100 %68 %47 -%102 = OpLoad %21 %101 -%104 = OpAccessChain %103 %68 %47 %47 -%105 = OpLoad %12 %104 -%106 = OpLoad %5 %93 -%107 = OpAccessChain %103 %68 %47 %106 -%108 = OpLoad %12 %107 -%110 = OpAccessChain %109 %68 %47 %47 %43 -%111 = OpLoad %8 %110 -%112 = OpLoad %5 %93 -%113 = OpAccessChain %109 %68 %47 %47 %112 -%114 = OpLoad %8 %113 -%115 = OpLoad %5 %93 -%116 = OpAccessChain %109 %68 %47 %115 %43 -%117 = OpLoad %8 %116 -%118 = OpLoad %5 %93 -%119 = OpLoad %5 %93 -%120 = OpAccessChain %109 %68 %47 %118 %119 -%121 = OpLoad %8 %120 -%122 = OpLoad %5 %93 -%123 = OpIAdd %5 %122 %69 -OpStore %93 %123 -%125 = OpAccessChain %124 %95 %47 -OpStore %125 %84 -%127 = OpAccessChain %126 %95 %47 %47 -OpStore %127 %86 -%128 = OpLoad %5 %93 -%129 = OpAccessChain %126 %95 %47 %128 -OpStore %129 %88 -%131 = OpAccessChain %130 %95 %47 %47 %43 -OpStore %131 %89 -%132 = OpLoad %5 %93 -%133 = OpAccessChain %130 %95 %47 %47 %132 -OpStore %133 %90 -%134 = OpLoad %5 %93 -%135 = OpAccessChain %130 %95 %47 %134 %43 -OpStore %135 %91 -%136 = OpLoad %5 %93 -%137 = OpLoad %5 %93 -%138 = OpAccessChain %130 %95 %47 %136 %137 -OpStore %138 %92 +%4 = OpTypeInt 32 0 +%5 = OpTypeVector %4 3 +%6 = OpTypeInt 32 1 +%7 = OpTypeStruct %4 %5 %6 +%8 = OpTypeStruct %6 +%9 = OpTypeFloat 32 +%11 = OpTypeVector %9 3 +%10 = OpTypeMatrix %11 4 +%13 = OpTypeVector %9 2 +%12 = OpTypeMatrix %13 2 +%15 = OpConstant %4 2 +%14 = OpTypeArray %12 %15 +%17 = OpConstant %4 10 +%16 = OpTypeArray %6 %17 +%18 = OpTypeVector %4 2 +%19 = OpTypeArray %18 %15 +%20 = OpTypeRuntimeArray %8 +%21 = OpTypeStruct %10 %14 %6 %16 %19 %20 +%22 = OpTypeMatrix %13 3 +%23 = OpTypeStruct %22 +%24 = OpTypeVector %6 2 +%25 = OpTypeMatrix %13 4 +%26 = OpTypeArray %25 %15 +%27 = OpTypeStruct %26 +%28 = OpTypePointer Function %9 +%29 = OpTypeArray %9 %17 +%31 = OpConstant %4 5 +%30 = OpTypeArray %29 %31 +%32 = OpTypeVector %9 4 +%33 = OpTypeArray %6 %31 +%34 = OpTypePointer Function %4 +%35 = OpTypeArray %32 %15 +%36 = OpTypePointer Function %35 +%37 = OpTypeStruct %4 +%38 = OpTypePointer Function %37 +%40 = OpConstant %4 4 +%39 = OpTypeArray %4 %40 +%41 = OpTypePointer Function %39 +%42 = OpTypeBool +%44 = OpConstant %4 1 +%43 = OpTypeArray %42 %44 +%45 = OpTypeStruct %6 +%46 = OpTypeStruct %6 +%47 = OpTypeStruct %46 %4 +%48 = OpConstant %4 0 +%49 = OpConstantComposite %5 %48 %48 %48 +%50 = OpConstant %6 0 +%51 = OpConstantComposite %7 %48 %49 %50 +%53 = OpTypePointer Private %7 +%52 = OpVariable %53 Private %51 +%55 = OpTypePointer StorageBuffer %21 +%54 = OpVariable %55 StorageBuffer +%57 = OpTypeStruct %23 +%58 = OpTypePointer Uniform %57 +%56 = OpVariable %58 Uniform +%60 = OpTypeStruct %24 +%61 = OpTypePointer StorageBuffer %60 +%59 = OpVariable %61 StorageBuffer +%63 = OpTypeStruct %27 +%64 = OpTypePointer Uniform %63 +%62 = OpVariable %64 Uniform +%67 = OpTypeFunction %2 +%68 = OpTypePointer Uniform %23 +%70 = OpConstant %6 1 +%71 = OpConstant %9 1.0 +%72 = OpConstantComposite %13 %71 %71 +%73 = OpConstant %9 2.0 +%74 = OpConstantComposite %13 %73 %73 +%75 = OpConstant %9 3.0 +%76 = OpConstantComposite %13 %75 %75 +%77 = OpConstantComposite %22 %72 %74 %76 +%78 = OpConstantComposite %23 %77 +%79 = OpConstant %9 6.0 +%80 = OpConstantComposite %13 %79 %79 +%81 = OpConstant %9 5.0 +%82 = OpConstantComposite %13 %81 %81 +%83 = OpConstant %9 4.0 +%84 = OpConstantComposite %13 %83 %83 +%85 = OpConstantComposite %22 %80 %82 %84 +%86 = OpConstant %9 9.0 +%87 = OpConstantComposite %13 %86 %86 +%88 = OpConstant %9 90.0 +%89 = OpConstantComposite %13 %88 %88 +%90 = OpConstant %9 10.0 +%91 = OpConstant %9 20.0 +%92 = OpConstant %9 30.0 +%93 = OpConstant %9 40.0 +%95 = OpTypePointer Function %6 +%97 = OpTypePointer Function %23 +%101 = OpTypePointer Uniform %22 +%104 = OpTypePointer Uniform %13 +%110 = OpTypePointer Uniform %9 +%125 = OpTypePointer Function %22 +%127 = OpTypePointer Function %13 +%131 = OpTypePointer Function %9 +%142 = OpTypePointer Uniform %27 +%144 = OpConstantNull %26 +%145 = OpConstantComposite %27 %144 +%146 = OpConstant %9 8.0 +%147 = OpConstantComposite %13 %146 %146 +%148 = OpConstant %9 7.0 +%149 = OpConstantComposite %13 %148 %148 +%150 = OpConstantComposite %25 %147 %149 %80 %82 +%153 = OpTypePointer Function %27 +%157 = OpTypePointer Uniform %26 +%160 = OpTypePointer Uniform %25 +%182 = OpTypePointer Function %26 +%184 = OpTypePointer Function %25 +%200 = OpTypeFunction %9 %28 +%206 = OpTypeFunction %9 %30 +%213 = OpTypeFunction %2 %34 +%214 = OpConstant %4 42 +%219 = OpTypeFunction %2 %36 +%220 = OpConstantComposite %32 %71 %71 %71 %71 +%221 = OpConstantComposite %32 %73 %73 %73 %73 +%222 = OpConstantComposite %35 %220 %221 +%227 = OpTypeFunction %4 %38 +%234 = OpTypeFunction %2 %38 +%240 = OpTypeFunction %4 %41 +%247 = OpTypeFunction %2 %41 +%253 = OpTypeFunction %42 %42 +%255 = OpTypePointer Function %43 +%256 = OpConstantNull %43 +%259 = OpTypePointer Function %42 +%264 = OpTypeFunction %6 +%265 = OpConstant %6 42 +%266 = OpConstantComposite %45 %265 +%268 = OpTypePointer Function %45 +%274 = OpConstantNull %47 +%287 = OpTypePointer Function %47 +%289 = OpTypePointer Function %46 +%290 = OpConstantNull %46 +%292 = OpConstantNull %6 +%308 = OpTypePointer Input %4 +%307 = OpVariable %308 Input +%311 = OpTypePointer Output %32 +%310 = OpVariable %311 Output +%314 = OpTypePointer StorageBuffer %24 +%317 = OpConstant %9 0.0 +%318 = OpConstant %4 3 +%319 = OpConstant %6 3 +%320 = OpConstant %6 4 +%321 = OpConstant %6 5 +%322 = OpConstantNull %30 +%325 = OpTypePointer Function %33 +%326 = OpConstantNull %33 +%331 = OpTypePointer StorageBuffer %10 +%334 = OpTypePointer StorageBuffer %19 +%337 = OpTypePointer StorageBuffer %11 +%338 = OpTypePointer StorageBuffer %9 +%341 = OpTypePointer StorageBuffer %20 +%344 = OpTypePointer StorageBuffer %8 +%345 = OpTypePointer StorageBuffer %6 +%357 = OpTypeVector %6 4 +%363 = OpVariable %311 Output +%366 = OpConstantComposite %11 %317 %317 %317 +%367 = OpConstantComposite %11 %71 %71 %71 +%368 = OpConstantComposite %11 %73 %73 %73 +%369 = OpConstantComposite %11 %75 %75 %75 +%370 = OpConstantComposite %10 %366 %367 %368 %369 +%371 = OpConstantComposite %18 %48 %48 +%372 = OpConstantComposite %18 %44 %44 +%373 = OpConstantComposite %19 %371 %372 +%374 = OpConstantNull %24 +%375 = OpConstantComposite %32 %317 %317 %317 %317 +%383 = OpConstant %4 33 +%384 = OpConstantComposite %32 %79 %79 %79 %79 +%385 = OpConstantComposite %32 %148 %148 %148 %148 +%386 = OpConstantComposite %35 %384 %385 +%395 = OpConstantNull %37 +%397 = OpConstantNull %39 +%66 = OpFunction %2 None %67 +%65 = OpLabel +%94 = OpVariable %95 Function %70 +%96 = OpVariable %97 Function %78 +%69 = OpAccessChain %68 %56 %48 +OpBranch %98 +%98 = OpLabel +OpLine %3 40 5 +%99 = OpLoad %6 %94 +%100 = OpISub %6 %99 %70 +OpLine %3 40 5 +OpStore %94 %100 +OpLine %3 43 14 +%102 = OpAccessChain %101 %69 %48 +%103 = OpLoad %22 %102 +OpLine %3 44 14 +OpLine %3 44 14 +%105 = OpAccessChain %104 %69 %48 %48 +%106 = OpLoad %13 %105 +OpLine %3 45 14 +%107 = OpLoad %6 %94 +%108 = OpAccessChain %104 %69 %48 %107 +%109 = OpLoad %13 %108 +OpLine %3 46 14 +OpLine %3 46 14 +OpLine %3 46 14 +%111 = OpAccessChain %110 %69 %48 %48 %44 +%112 = OpLoad %9 %111 +OpLine %3 47 14 +OpLine %3 47 14 +%113 = OpLoad %6 %94 +%114 = OpAccessChain %110 %69 %48 %48 %113 +%115 = OpLoad %9 %114 +OpLine %3 48 14 +%116 = OpLoad %6 %94 +OpLine %3 48 14 +%117 = OpAccessChain %110 %69 %48 %116 %44 +%118 = OpLoad %9 %117 +OpLine %3 49 14 +%119 = OpLoad %6 %94 +%120 = OpLoad %6 %94 +%121 = OpAccessChain %110 %69 %48 %119 %120 +%122 = OpLoad %9 %121 +OpLine %3 51 29 +OpLine %3 51 45 +OpLine %3 51 13 +OpLine %3 53 5 +%123 = OpLoad %6 %94 +%124 = OpIAdd %6 %123 %70 +OpLine %3 53 5 +OpStore %94 %124 +OpLine %3 56 5 +OpLine %3 56 23 +OpLine %3 56 39 +OpLine %3 56 11 +OpLine %3 56 5 +%126 = OpAccessChain %125 %96 %48 +OpStore %126 %85 +OpLine %3 57 5 +OpLine %3 57 5 +OpLine %3 57 14 +OpLine %3 57 5 +%128 = OpAccessChain %127 %96 %48 %48 +OpStore %128 %87 +OpLine %3 58 5 +%129 = OpLoad %6 %94 +OpLine %3 58 16 +OpLine %3 58 5 +%130 = OpAccessChain %127 %96 %48 %129 +OpStore %130 %89 +OpLine %3 59 5 +OpLine %3 59 5 +OpLine %3 59 5 +OpLine %3 59 5 +%132 = OpAccessChain %131 %96 %48 %48 %44 +OpStore %132 %90 +OpLine %3 60 5 +OpLine %3 60 5 +%133 = OpLoad %6 %94 +OpLine %3 60 5 +%134 = OpAccessChain %131 %96 %48 %48 %133 +OpStore %134 %91 +OpLine %3 61 5 +%135 = OpLoad %6 %94 +OpLine %3 61 5 +OpLine %3 61 5 +%136 = OpAccessChain %131 %96 %48 %135 %44 +OpStore %136 %92 +OpLine %3 62 5 +%137 = OpLoad %6 %94 +%138 = OpLoad %6 %94 +OpLine %3 62 5 +%139 = OpAccessChain %131 %96 %48 %137 %138 +OpStore %139 %93 OpReturn OpFunctionEnd -%140 = OpFunction %2 None %66 -%139 = OpLabel -%150 = OpVariable %94 Function %69 -%151 = OpVariable %152 Function %144 -%142 = OpAccessChain %141 %61 %47 -OpBranch %153 -%153 = OpLabel -%154 = OpLoad %5 %150 -%155 = OpISub %5 %154 %69 -OpStore %150 %155 -%157 = OpAccessChain %156 %142 %47 -%158 = OpLoad %25 %157 -%160 = OpAccessChain %159 %142 %47 %47 -%161 = OpLoad %24 %160 -%162 = OpAccessChain %103 %142 %47 %47 %47 -%163 = OpLoad %12 %162 -%164 = OpLoad %5 %150 -%165 = OpAccessChain %103 %142 %47 %47 %164 -%166 = OpLoad %12 %165 -%167 = OpAccessChain %109 %142 %47 %47 %47 %43 -%168 = OpLoad %8 %167 -%169 = OpLoad %5 %150 -%170 = OpAccessChain %109 %142 %47 %47 %47 %169 -%171 = OpLoad %8 %170 -%172 = OpLoad %5 %150 -%173 = OpAccessChain %109 %142 %47 %47 %172 %43 -%174 = OpLoad %8 %173 -%175 = OpLoad %5 %150 -%176 = OpLoad %5 %150 -%177 = OpAccessChain %109 %142 %47 %47 %175 %176 -%178 = OpLoad %8 %177 -%179 = OpLoad %5 %150 -%180 = OpIAdd %5 %179 %69 -OpStore %150 %180 -%182 = OpAccessChain %181 %151 %47 -OpStore %182 %143 -%184 = OpAccessChain %183 %151 %47 %47 -OpStore %184 %149 -%185 = OpAccessChain %126 %151 %47 %47 %47 -OpStore %185 %86 -%186 = OpLoad %5 %150 -%187 = OpAccessChain %126 %151 %47 %47 %186 -OpStore %187 %88 -%188 = OpAccessChain %130 %151 %47 %47 %47 %43 +%141 = OpFunction %2 None %67 +%140 = OpLabel +%151 = OpVariable %95 Function %70 +%152 = OpVariable %153 Function %145 +%143 = OpAccessChain %142 %62 %48 +OpBranch %154 +%154 = OpLabel +OpLine %3 75 5 +%155 = OpLoad %6 %151 +%156 = OpISub %6 %155 %70 +OpLine %3 75 5 +OpStore %151 %156 +OpLine %3 78 14 +%158 = OpAccessChain %157 %143 %48 +%159 = OpLoad %26 %158 +OpLine %3 79 14 +OpLine %3 79 14 +%161 = OpAccessChain %160 %143 %48 %48 +%162 = OpLoad %25 %161 +OpLine %3 80 14 +OpLine %3 80 14 +OpLine %3 80 14 +%163 = OpAccessChain %104 %143 %48 %48 %48 +%164 = OpLoad %13 %163 +OpLine %3 81 14 +OpLine %3 81 14 +%165 = OpLoad %6 %151 +%166 = OpAccessChain %104 %143 %48 %48 %165 +%167 = OpLoad %13 %166 +OpLine %3 82 14 +OpLine %3 82 14 +OpLine %3 82 14 +OpLine %3 82 14 +%168 = OpAccessChain %110 %143 %48 %48 %48 %44 +%169 = OpLoad %9 %168 +OpLine %3 83 14 +OpLine %3 83 14 +OpLine %3 83 14 +%170 = OpLoad %6 %151 +%171 = OpAccessChain %110 %143 %48 %48 %48 %170 +%172 = OpLoad %9 %171 +OpLine %3 84 14 +OpLine %3 84 14 +%173 = OpLoad %6 %151 +OpLine %3 84 14 +%174 = OpAccessChain %110 %143 %48 %48 %173 %44 +%175 = OpLoad %9 %174 +OpLine %3 85 14 +OpLine %3 85 14 +%176 = OpLoad %6 %151 +%177 = OpLoad %6 %151 +%178 = OpAccessChain %110 %143 %48 %48 %176 %177 +%179 = OpLoad %9 %178 +OpLine %3 87 13 +OpLine %3 89 5 +%180 = OpLoad %6 %151 +%181 = OpIAdd %6 %180 %70 +OpLine %3 89 5 +OpStore %151 %181 +OpLine %3 92 5 +OpLine %3 92 5 +%183 = OpAccessChain %182 %152 %48 +OpStore %183 %144 +OpLine %3 93 5 +OpLine %3 93 5 +OpLine %3 93 27 +OpLine %3 93 43 +OpLine %3 93 59 +OpLine %3 93 15 +OpLine %3 93 5 +%185 = OpAccessChain %184 %152 %48 %48 +OpStore %185 %150 +OpLine %3 94 5 +OpLine %3 94 5 +OpLine %3 94 5 +OpLine %3 94 18 +OpLine %3 94 5 +%186 = OpAccessChain %127 %152 %48 %48 %48 +OpStore %186 %87 +OpLine %3 95 5 +OpLine %3 95 5 +%187 = OpLoad %6 %151 +OpLine %3 95 20 +OpLine %3 95 5 +%188 = OpAccessChain %127 %152 %48 %48 %187 OpStore %188 %89 -%189 = OpLoad %5 %150 -%190 = OpAccessChain %130 %151 %47 %47 %47 %189 -OpStore %190 %90 -%191 = OpLoad %5 %150 -%192 = OpAccessChain %130 %151 %47 %47 %191 %43 -OpStore %192 %91 -%193 = OpLoad %5 %150 -%194 = OpLoad %5 %150 -%195 = OpAccessChain %130 %151 %47 %47 %193 %194 -OpStore %195 %92 +OpLine %3 96 5 +OpLine %3 96 5 +OpLine %3 96 5 +OpLine %3 96 5 +OpLine %3 96 5 +%189 = OpAccessChain %131 %152 %48 %48 %48 %44 +OpStore %189 %90 +OpLine %3 97 5 +OpLine %3 97 5 +OpLine %3 97 5 +%190 = OpLoad %6 %151 +OpLine %3 97 5 +%191 = OpAccessChain %131 %152 %48 %48 %48 %190 +OpStore %191 %91 +OpLine %3 98 5 +OpLine %3 98 5 +%192 = OpLoad %6 %151 +OpLine %3 98 5 +OpLine %3 98 5 +%193 = OpAccessChain %131 %152 %48 %48 %192 %44 +OpStore %193 %92 +OpLine %3 99 5 +OpLine %3 99 5 +%194 = OpLoad %6 %151 +%195 = OpLoad %6 %151 +OpLine %3 99 5 +%196 = OpAccessChain %131 %152 %48 %48 %194 %195 +OpStore %196 %93 OpReturn OpFunctionEnd -%198 = OpFunction %8 None %199 -%197 = OpFunctionParameter %27 -%196 = OpLabel -OpBranch %200 -%200 = OpLabel -%201 = OpLoad %8 %197 -OpReturnValue %201 +%199 = OpFunction %9 None %200 +%198 = OpFunctionParameter %28 +%197 = OpLabel +OpBranch %201 +%201 = OpLabel +OpLine %3 102 22 +%202 = OpLoad %9 %198 +OpReturnValue %202 OpFunctionEnd -%204 = OpFunction %8 None %205 -%203 = OpFunctionParameter %29 -%202 = OpLabel -OpBranch %206 -%206 = OpLabel -%207 = OpCompositeExtract %28 %203 4 -%208 = OpCompositeExtract %8 %207 9 -OpReturnValue %208 +%205 = OpFunction %9 None %206 +%204 = OpFunctionParameter %30 +%203 = OpLabel +OpBranch %207 +%207 = OpLabel +OpLine %3 107 12 +%208 = OpCompositeExtract %29 %204 4 +OpLine %3 107 12 +%209 = OpCompositeExtract %9 %208 9 +OpReturnValue %209 OpFunctionEnd -%211 = OpFunction %2 None %212 -%210 = OpFunctionParameter %33 -%209 = OpLabel -OpBranch %214 -%214 = OpLabel -OpStore %210 %213 -OpReturn -OpFunctionEnd -%217 = OpFunction %2 None %218 -%216 = OpFunctionParameter %35 +%212 = OpFunction %2 None %213 +%211 = OpFunctionParameter %34 +%210 = OpLabel +OpBranch %215 %215 = OpLabel -OpBranch %222 -%222 = OpLabel -OpStore %216 %221 +OpLine %3 155 5 +OpStore %211 %214 OpReturn OpFunctionEnd -%225 = OpFunction %3 None %226 -%224 = OpFunctionParameter %37 +%218 = OpFunction %2 None %219 +%217 = OpFunctionParameter %36 +%216 = OpLabel +OpBranch %223 %223 = OpLabel -OpBranch %227 -%227 = OpLabel -%228 = OpAccessChain %33 %224 %47 -%229 = OpLoad %3 %228 -OpReturnValue %229 -OpFunctionEnd -%232 = OpFunction %2 None %233 -%231 = OpFunctionParameter %37 -%230 = OpLabel -OpBranch %234 -%234 = OpLabel -%235 = OpAccessChain %33 %231 %47 -OpStore %235 %16 +OpLine %3 159 32 +OpLine %3 159 43 +OpLine %3 159 32 +OpLine %3 159 12 +OpLine %3 159 5 +OpStore %217 %222 OpReturn OpFunctionEnd -%238 = OpFunction %3 None %239 -%237 = OpFunctionParameter %40 -%236 = OpLabel -OpBranch %240 -%240 = OpLabel -%241 = OpAccessChain %33 %237 %43 -%242 = OpLoad %3 %241 -OpReturnValue %242 +%226 = OpFunction %4 None %227 +%225 = OpFunctionParameter %38 +%224 = OpLabel +OpBranch %228 +%228 = OpLabel +OpLine %3 176 10 +%229 = OpAccessChain %34 %225 %48 +%230 = OpLoad %4 %229 +OpReturnValue %230 OpFunctionEnd -%245 = OpFunction %2 None %246 -%244 = OpFunctionParameter %40 -%243 = OpLabel -OpBranch %247 -%247 = OpLabel -%248 = OpAccessChain %33 %244 %43 -OpStore %248 %16 +%233 = OpFunction %2 None %234 +%232 = OpFunctionParameter %38 +%231 = OpLabel +OpBranch %235 +%235 = OpLabel +OpLine %3 180 3 +OpLine %3 180 3 +%236 = OpAccessChain %34 %232 %48 +OpStore %236 %17 OpReturn OpFunctionEnd -%251 = OpFunction %41 None %252 -%250 = OpFunctionParameter %41 -%249 = OpLabel -%253 = OpVariable %254 Function %255 -OpBranch %256 -%256 = OpLabel -%257 = OpCompositeConstruct %42 %250 -OpStore %253 %257 -%259 = OpAccessChain %258 %253 %47 -%260 = OpLoad %41 %259 -OpReturnValue %260 +%239 = OpFunction %4 None %240 +%238 = OpFunctionParameter %41 +%237 = OpLabel +OpBranch %241 +%241 = OpLabel +OpLine %3 184 10 +%242 = OpAccessChain %34 %238 %44 +%243 = OpLoad %4 %242 +OpReturnValue %243 OpFunctionEnd -%262 = OpFunction %5 None %263 -%261 = OpLabel -%266 = OpVariable %267 Function %265 -OpBranch %268 -%268 = OpLabel -%269 = OpAccessChain %94 %266 %47 -%270 = OpLoad %5 %269 -OpReturnValue %270 -OpFunctionEnd -%272 = OpFunction %5 None %263 -%271 = OpLabel -OpBranch %274 -%274 = OpLabel -%275 = OpCompositeExtract %45 %273 0 -%276 = OpCompositeExtract %5 %275 0 -%277 = OpCompositeExtract %3 %273 1 -%278 = OpBitcast %3 %276 -%279 = OpINotEqual %41 %277 %278 -OpSelectionMerge %280 None -OpBranchConditional %279 %280 %280 -%280 = OpLabel -%281 = OpCompositeExtract %45 %273 0 -%282 = OpCompositeExtract %5 %281 0 -OpReturnValue %282 -OpFunctionEnd -%284 = OpFunction %5 None %263 -%283 = OpLabel -%285 = OpVariable %286 Function %273 -%287 = OpVariable %288 Function %289 -%290 = OpVariable %94 Function %291 -OpBranch %292 -%292 = OpLabel -%293 = OpAccessChain %288 %285 %47 -%294 = OpLoad %45 %293 -OpStore %287 %294 -%295 = OpAccessChain %94 %287 %47 -%296 = OpLoad %5 %295 -OpStore %290 %296 -%297 = OpAccessChain %33 %285 %43 -%298 = OpLoad %3 %297 -%299 = OpLoad %5 %290 -%300 = OpBitcast %3 %299 -%301 = OpINotEqual %41 %298 %300 -OpSelectionMerge %302 None -OpBranchConditional %301 %302 %302 -%302 = OpLabel -%303 = OpAccessChain %94 %285 %47 %47 -%304 = OpLoad %5 %303 -OpReturnValue %304 -OpFunctionEnd -%311 = OpFunction %2 None %66 -%305 = OpLabel -%322 = OpVariable %27 Function %316 -%323 = OpVariable %324 Function %325 -%308 = OpLoad %3 %306 -%312 = OpAccessChain %67 %55 %47 -%314 = OpAccessChain %313 %58 %47 -%315 = OpAccessChain %141 %61 %47 -OpBranch %326 -%326 = OpLabel -%327 = OpLoad %8 %322 -OpStore %322 %70 -%328 = OpFunctionCall %2 %65 -%329 = OpFunctionCall %2 %140 -%331 = OpAccessChain %330 %53 %47 -%332 = OpLoad %9 %331 -%334 = OpAccessChain %333 %53 %39 -%335 = OpLoad %18 %334 -%338 = OpAccessChain %337 %53 %47 %317 %47 -%339 = OpLoad %8 %338 -%341 = OpArrayLength %3 %53 5 -%342 = OpISub %3 %341 %14 -%345 = OpAccessChain %344 %53 %30 %342 %47 -%346 = OpLoad %5 %345 -%347 = OpLoad %23 %314 -%348 = OpFunctionCall %8 %198 %322 -%349 = OpConvertFToS %5 %339 -%350 = OpCompositeConstruct %32 %346 %349 %318 %319 %320 -OpStore %323 %350 -%351 = OpIAdd %3 %308 %43 -%352 = OpAccessChain %94 %323 %351 -OpStore %352 %264 -%353 = OpAccessChain %94 %323 %308 -%354 = OpLoad %5 %353 -%355 = OpFunctionCall %8 %204 %321 -%357 = OpCompositeConstruct %356 %354 %354 %354 %354 -%358 = OpConvertSToF %31 %357 -%359 = OpMatrixTimesVector %10 %332 %358 -%360 = OpCompositeConstruct %31 %359 %72 -OpStore %309 %360 +%246 = OpFunction %2 None %247 +%245 = OpFunctionParameter %41 +%244 = OpLabel +OpBranch %248 +%248 = OpLabel +OpLine %3 188 3 +OpLine %3 188 3 +%249 = OpAccessChain %34 %245 %44 +OpStore %249 %17 OpReturn OpFunctionEnd -%363 = OpFunction %2 None %66 -%361 = OpLabel -%364 = OpAccessChain %313 %58 %47 -OpBranch %375 -%375 = OpLabel -%376 = OpAccessChain %337 %53 %47 %43 %14 -OpStore %376 %70 -%377 = OpAccessChain %330 %53 %47 -OpStore %377 %369 -%378 = OpAccessChain %333 %53 %39 -OpStore %378 %372 -%379 = OpAccessChain %344 %53 %30 %43 %47 -OpStore %379 %69 -OpStore %364 %373 -OpStore %362 %374 +%252 = OpFunction %42 None %253 +%251 = OpFunctionParameter %42 +%250 = OpLabel +%254 = OpVariable %255 Function %256 +OpBranch %257 +%257 = OpLabel +OpLine %3 203 13 +%258 = OpCompositeConstruct %43 %251 +OpLine %3 203 5 +OpStore %254 %258 +OpLine %3 205 12 +%260 = OpAccessChain %259 %254 %48 +%261 = OpLoad %42 %260 +OpReturnValue %261 +OpFunctionEnd +%263 = OpFunction %6 None %264 +%262 = OpLabel +%267 = OpVariable %268 Function %266 +OpBranch %269 +%269 = OpLabel +OpLine %3 211 16 +OpLine %3 213 12 +%270 = OpAccessChain %95 %267 %48 +%271 = OpLoad %6 %270 +OpReturnValue %271 +OpFunctionEnd +%273 = OpFunction %6 None %264 +%272 = OpLabel +OpBranch %275 +%275 = OpLabel +OpLine %3 223 17 +%276 = OpCompositeExtract %46 %274 0 +OpLine %3 224 20 +%277 = OpCompositeExtract %6 %276 0 +OpLine %3 226 9 +%278 = OpCompositeExtract %4 %274 1 +%279 = OpBitcast %4 %277 +%280 = OpINotEqual %42 %278 %279 +OpLine %3 226 5 +OpSelectionMerge %281 None +OpBranchConditional %280 %281 %281 +%281 = OpLabel +OpLine %3 230 12 +%282 = OpCompositeExtract %46 %274 0 +%283 = OpCompositeExtract %6 %282 0 +OpReturnValue %283 +OpFunctionEnd +%285 = OpFunction %6 None %264 +%284 = OpLabel +%286 = OpVariable %287 Function %274 +%288 = OpVariable %289 Function %290 +%291 = OpVariable %95 Function %292 +OpBranch %293 +%293 = OpLabel +OpLine %3 236 17 +%294 = OpAccessChain %289 %286 %48 +%295 = OpLoad %46 %294 +OpLine %3 236 5 +OpStore %288 %295 +OpLine %3 237 20 +%296 = OpAccessChain %95 %288 %48 +%297 = OpLoad %6 %296 +OpLine %3 237 5 +OpStore %291 %297 +OpLine %3 239 9 +%298 = OpAccessChain %34 %286 %44 +%299 = OpLoad %4 %298 +%300 = OpLoad %6 %291 +%301 = OpBitcast %4 %300 +%302 = OpINotEqual %42 %299 %301 +OpLine %3 239 5 +OpSelectionMerge %303 None +OpBranchConditional %302 %303 %303 +%303 = OpLabel +OpLine %3 243 12 +%304 = OpAccessChain %95 %286 %48 %48 +%305 = OpLoad %6 %304 +OpReturnValue %305 +OpFunctionEnd +%312 = OpFunction %2 None %67 +%306 = OpLabel +%323 = OpVariable %28 Function %317 +%324 = OpVariable %325 Function %326 +%309 = OpLoad %4 %307 +%313 = OpAccessChain %68 %56 %48 +%315 = OpAccessChain %314 %59 %48 +%316 = OpAccessChain %142 %62 %48 +OpBranch %327 +%327 = OpLabel +OpLine %3 1 1 +%328 = OpLoad %9 %323 +OpLine %3 115 5 +OpStore %323 %71 +OpLine %3 117 2 +%329 = OpFunctionCall %2 %66 +OpLine %3 118 2 +%330 = OpFunctionCall %2 %141 +OpLine %3 121 16 +%332 = OpAccessChain %331 %54 %48 +%333 = OpLoad %10 %332 +OpLine %3 122 12 +%335 = OpAccessChain %334 %54 %40 +%336 = OpLoad %19 %335 +OpLine %3 124 10 +%339 = OpAccessChain %338 %54 %48 %318 %48 +%340 = OpLoad %9 %339 +OpLine %3 125 10 +OpLine %3 125 19 +%342 = OpArrayLength %4 %54 5 +OpLine %3 125 10 +%343 = OpISub %4 %342 %15 +%346 = OpAccessChain %345 %54 %31 %343 %48 +%347 = OpLoad %6 %346 +OpLine %3 126 10 +%348 = OpLoad %24 %315 +OpLine %3 129 53 +OpLine %3 129 53 +OpLine %3 130 18 +%349 = OpFunctionCall %9 %199 %323 +OpLine %3 133 28 +%350 = OpConvertFToS %6 %340 +OpLine %3 133 11 +%351 = OpCompositeConstruct %33 %347 %350 %319 %320 %321 +OpLine %3 133 2 +OpStore %324 %351 +OpLine %3 134 2 +%352 = OpIAdd %4 %309 %44 +OpLine %3 134 2 +%353 = OpAccessChain %95 %324 %352 +OpStore %353 %265 +OpLine %3 135 14 +%354 = OpAccessChain %95 %324 %309 +%355 = OpLoad %6 %354 +OpLine %3 137 2 +%356 = OpFunctionCall %9 %205 %322 +OpLine %3 139 19 +%358 = OpCompositeConstruct %357 %355 %355 %355 %355 +%359 = OpConvertSToF %32 %358 +%360 = OpMatrixTimesVector %11 %333 %359 +OpLine %3 139 9 +%361 = OpCompositeConstruct %32 %360 %73 +OpStore %310 %361 OpReturn OpFunctionEnd -%381 = OpFunction %2 None %66 -%380 = OpLabel -%386 = OpVariable %33 Function %382 -%387 = OpVariable %35 Function %385 -OpBranch %388 -%388 = OpLabel -%389 = OpFunctionCall %2 %211 %386 -%390 = OpFunctionCall %2 %217 %387 +%364 = OpFunction %2 None %67 +%362 = OpLabel +%365 = OpAccessChain %314 %59 %48 +OpBranch %376 +%376 = OpLabel +OpLine %3 145 2 +OpLine %3 145 2 +OpLine %3 145 2 +%377 = OpAccessChain %338 %54 %48 %44 %15 +OpStore %377 %71 +OpLine %3 146 2 +OpLine %3 146 28 +OpLine %3 146 44 +OpLine %3 146 60 +OpLine %3 146 16 +OpLine %3 146 2 +%378 = OpAccessChain %331 %54 %48 +OpStore %378 %370 +OpLine %3 147 2 +OpLine %3 147 32 +OpLine %3 147 12 +OpLine %3 147 2 +%379 = OpAccessChain %334 %54 %40 +OpStore %379 %373 +OpLine %3 148 2 +OpLine %3 148 2 +OpLine %3 148 2 +%380 = OpAccessChain %345 %54 %31 %44 %48 +OpStore %380 %70 +OpLine %3 149 2 +OpStore %365 %374 +OpLine %3 151 9 +OpStore %363 %375 OpReturn OpFunctionEnd -%392 = OpFunction %2 None %66 -%391 = OpLabel -%393 = OpVariable %37 Function %394 -%395 = OpVariable %40 Function %396 -OpBranch %397 -%397 = OpLabel -%398 = OpFunctionCall %2 %232 %393 -%399 = OpFunctionCall %3 %225 %393 -%400 = OpFunctionCall %2 %245 %395 -%401 = OpFunctionCall %3 %238 %395 +%382 = OpFunction %2 None %67 +%381 = OpLabel +%387 = OpVariable %34 Function %383 +%388 = OpVariable %36 Function %386 +OpBranch %389 +%389 = OpLabel +OpLine %3 165 5 +%390 = OpFunctionCall %2 %212 %387 +OpLine %3 167 32 +OpLine %3 167 43 +OpLine %3 167 32 +OpLine %3 167 12 +OpLine %3 168 5 +%391 = OpFunctionCall %2 %218 %388 +OpReturn +OpFunctionEnd +%393 = OpFunction %2 None %67 +%392 = OpLabel +%394 = OpVariable %38 Function %395 +%396 = OpVariable %41 Function %397 +OpBranch %398 +%398 = OpLabel +OpLine %3 194 4 +%399 = OpFunctionCall %2 %233 %394 +OpLine %3 195 4 +%400 = OpFunctionCall %4 %226 %394 +OpLine %3 198 4 +%401 = OpFunctionCall %2 %246 %396 +OpLine %3 199 4 +%402 = OpFunctionCall %4 %239 %396 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/boids.spvasm b/naga/tests/out/spv/boids.spvasm index 4fc1cbf49f..dafc86bfa3 100644 --- a/naga/tests/out/spv/boids.spvasm +++ b/naga/tests/out/spv/boids.spvasm @@ -1,332 +1,530 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 208 +; Bound: 209 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %23 "main" %20 -OpExecutionMode %23 LocalSize 64 1 1 -OpMemberName %6 0 "pos" -OpMemberName %6 1 "vel" -OpName %6 "Particle" -OpMemberName %7 0 "deltaT" -OpMemberName %7 1 "rule1Distance" -OpMemberName %7 2 "rule2Distance" -OpMemberName %7 3 "rule3Distance" -OpMemberName %7 4 "rule1Scale" -OpMemberName %7 5 "rule2Scale" -OpMemberName %7 6 "rule3Scale" -OpName %7 "SimParams" -OpMemberName %9 0 "particles" -OpName %9 "Particles" -OpName %12 "NUM_PARTICLES" -OpName %13 "params" -OpName %16 "particlesSrc" -OpName %18 "particlesDst" -OpName %20 "global_invocation_id" -OpName %23 "main" -OpName %36 "vPos" -OpName %39 "vVel" -OpName %41 "cMass" -OpName %42 "cVel" -OpName %43 "colVel" -OpName %44 "cMassCount" -OpName %46 "cVelCount" -OpName %47 "pos" -OpName %49 "vel" -OpName %51 "i" -OpMemberDecorate %6 0 Offset 0 -OpMemberDecorate %6 1 Offset 8 +OpEntryPoint GLCompute %24 "main" %21 +OpExecutionMode %24 LocalSize 64 1 1 +%3 = OpString "boids.wgsl" +OpSource Unknown 0 %3 "const NUM_PARTICLES: u32 = 1500u; + +struct Particle { + pos : vec2, + vel : vec2, +} + +struct SimParams { + deltaT : f32, + rule1Distance : f32, + rule2Distance : f32, + rule3Distance : f32, + rule1Scale : f32, + rule2Scale : f32, + rule3Scale : f32, +} + +struct Particles { + particles : array +} + +@group(0) @binding(0) var params : SimParams; +@group(0) @binding(1) var particlesSrc : Particles; +@group(0) @binding(2) var particlesDst : Particles; + +// https://github.com/austinEng/Project6-Vulkan-Flocking/blob/master/data/shaders/computeparticles/particle.comp +@compute @workgroup_size(64) +fn main(@builtin(global_invocation_id) global_invocation_id : vec3) { + let index : u32 = global_invocation_id.x; + if index >= NUM_PARTICLES { + return; + } + + var vPos = particlesSrc.particles[index].pos; + var vVel = particlesSrc.particles[index].vel; + + var cMass = vec2(0.0, 0.0); + var cVel = vec2(0.0, 0.0); + var colVel = vec2(0.0, 0.0); + var cMassCount : i32 = 0; + var cVelCount : i32 = 0; + + var pos : vec2; + var vel : vec2; + var i : u32 = 0u; + loop { + if i >= NUM_PARTICLES { + break; + } + if i == index { + continue; + } + + pos = particlesSrc.particles[i].pos; + vel = particlesSrc.particles[i].vel; + + if distance(pos, vPos) < params.rule1Distance { + cMass = cMass + pos; + cMassCount = cMassCount + 1; + } + if distance(pos, vPos) < params.rule2Distance { + colVel = colVel - (pos - vPos); + } + if distance(pos, vPos) < params.rule3Distance { + cVel = cVel + vel; + cVelCount = cVelCount + 1; + } + + continuing { + i = i + 1u; + } + } + if cMassCount > 0 { + cMass = cMass / f32(cMassCount) - vPos; + } + if cVelCount > 0 { + cVel = cVel / f32(cVelCount); + } + + vVel = vVel + (cMass * params.rule1Scale) + + (colVel * params.rule2Scale) + + (cVel * params.rule3Scale); + + // clamp velocity for a more pleasing simulation + vVel = normalize(vVel) * clamp(length(vVel), 0.0, 0.1); + + // kinematic update + vPos = vPos + (vVel * params.deltaT); + + // Wrap around boundary + if vPos.x < -1.0 { + vPos.x = 1.0; + } + if vPos.x > 1.0 { + vPos.x = -1.0; + } + if vPos.y < -1.0 { + vPos.y = 1.0; + } + if vPos.y > 1.0 { + vPos.y = -1.0; + } + + // Write back + particlesDst.particles[index].pos = vPos; + particlesDst.particles[index].vel = vVel; +} +" +OpMemberName %7 0 "pos" +OpMemberName %7 1 "vel" +OpName %7 "Particle" +OpMemberName %8 0 "deltaT" +OpMemberName %8 1 "rule1Distance" +OpMemberName %8 2 "rule2Distance" +OpMemberName %8 3 "rule3Distance" +OpMemberName %8 4 "rule1Scale" +OpMemberName %8 5 "rule2Scale" +OpMemberName %8 6 "rule3Scale" +OpName %8 "SimParams" +OpMemberName %10 0 "particles" +OpName %10 "Particles" +OpName %13 "NUM_PARTICLES" +OpName %14 "params" +OpName %17 "particlesSrc" +OpName %19 "particlesDst" +OpName %21 "global_invocation_id" +OpName %24 "main" +OpName %37 "vPos" +OpName %40 "vVel" +OpName %42 "cMass" +OpName %43 "cVel" +OpName %44 "colVel" +OpName %45 "cMassCount" +OpName %47 "cVelCount" +OpName %48 "pos" +OpName %50 "vel" +OpName %52 "i" OpMemberDecorate %7 0 Offset 0 -OpMemberDecorate %7 1 Offset 4 -OpMemberDecorate %7 2 Offset 8 -OpMemberDecorate %7 3 Offset 12 -OpMemberDecorate %7 4 Offset 16 -OpMemberDecorate %7 5 Offset 20 -OpMemberDecorate %7 6 Offset 24 -OpDecorate %8 ArrayStride 16 -OpMemberDecorate %9 0 Offset 0 -OpDecorate %9 Block -OpDecorate %13 DescriptorSet 0 -OpDecorate %13 Binding 0 -OpDecorate %14 Block -OpMemberDecorate %14 0 Offset 0 -OpDecorate %16 NonWritable -OpDecorate %16 DescriptorSet 0 -OpDecorate %16 Binding 1 -OpDecorate %18 DescriptorSet 0 -OpDecorate %18 Binding 2 -OpDecorate %20 BuiltIn GlobalInvocationId +OpMemberDecorate %7 1 Offset 8 +OpMemberDecorate %8 0 Offset 0 +OpMemberDecorate %8 1 Offset 4 +OpMemberDecorate %8 2 Offset 8 +OpMemberDecorate %8 3 Offset 12 +OpMemberDecorate %8 4 Offset 16 +OpMemberDecorate %8 5 Offset 20 +OpMemberDecorate %8 6 Offset 24 +OpDecorate %9 ArrayStride 16 +OpMemberDecorate %10 0 Offset 0 +OpDecorate %10 Block +OpDecorate %14 DescriptorSet 0 +OpDecorate %14 Binding 0 +OpDecorate %15 Block +OpMemberDecorate %15 0 Offset 0 +OpDecorate %17 NonWritable +OpDecorate %17 DescriptorSet 0 +OpDecorate %17 Binding 1 +OpDecorate %19 DescriptorSet 0 +OpDecorate %19 Binding 2 +OpDecorate %21 BuiltIn GlobalInvocationId %2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%4 = OpTypeFloat 32 -%5 = OpTypeVector %4 2 -%6 = OpTypeStruct %5 %5 -%7 = OpTypeStruct %4 %4 %4 %4 %4 %4 %4 -%8 = OpTypeRuntimeArray %6 -%9 = OpTypeStruct %8 -%10 = OpTypeVector %3 3 -%11 = OpTypeInt 32 1 -%12 = OpConstant %3 1500 -%14 = OpTypeStruct %7 -%15 = OpTypePointer Uniform %14 -%13 = OpVariable %15 Uniform -%17 = OpTypePointer StorageBuffer %9 -%16 = OpVariable %17 StorageBuffer -%18 = OpVariable %17 StorageBuffer -%21 = OpTypePointer Input %10 -%20 = OpVariable %21 Input -%24 = OpTypeFunction %2 -%25 = OpTypePointer Uniform %7 -%26 = OpConstant %3 0 -%28 = OpConstant %4 0.0 -%29 = OpConstantComposite %5 %28 %28 -%30 = OpConstant %11 0 -%31 = OpConstant %11 1 -%32 = OpConstant %3 1 -%33 = OpConstant %4 0.1 -%34 = OpConstant %4 -1.0 -%35 = OpConstant %4 1.0 -%37 = OpTypePointer Function %5 -%38 = OpConstantNull %5 -%40 = OpConstantNull %5 -%45 = OpTypePointer Function %11 -%48 = OpConstantNull %5 -%50 = OpConstantNull %5 -%52 = OpTypePointer Function %3 -%55 = OpTypeBool -%59 = OpTypePointer StorageBuffer %8 -%60 = OpTypePointer StorageBuffer %6 -%61 = OpTypePointer StorageBuffer %5 -%87 = OpTypePointer Uniform %4 -%101 = OpConstant %3 2 -%115 = OpConstant %3 3 -%150 = OpConstant %3 4 -%156 = OpConstant %3 5 -%162 = OpConstant %3 6 -%179 = OpTypePointer Function %4 -%23 = OpFunction %2 None %24 -%19 = OpLabel -%51 = OpVariable %52 Function %26 -%46 = OpVariable %45 Function %30 -%42 = OpVariable %37 Function %29 -%36 = OpVariable %37 Function %38 -%47 = OpVariable %37 Function %48 -%43 = OpVariable %37 Function %29 -%39 = OpVariable %37 Function %40 -%49 = OpVariable %37 Function %50 -%44 = OpVariable %45 Function %30 -%41 = OpVariable %37 Function %29 -%22 = OpLoad %10 %20 -%27 = OpAccessChain %25 %13 %26 -OpBranch %53 -%53 = OpLabel -%54 = OpCompositeExtract %3 %22 0 -%56 = OpUGreaterThanEqual %55 %54 %12 -OpSelectionMerge %57 None -OpBranchConditional %56 %58 %57 -%58 = OpLabel +%4 = OpTypeInt 32 0 +%5 = OpTypeFloat 32 +%6 = OpTypeVector %5 2 +%7 = OpTypeStruct %6 %6 +%8 = OpTypeStruct %5 %5 %5 %5 %5 %5 %5 +%9 = OpTypeRuntimeArray %7 +%10 = OpTypeStruct %9 +%11 = OpTypeVector %4 3 +%12 = OpTypeInt 32 1 +%13 = OpConstant %4 1500 +%15 = OpTypeStruct %8 +%16 = OpTypePointer Uniform %15 +%14 = OpVariable %16 Uniform +%18 = OpTypePointer StorageBuffer %10 +%17 = OpVariable %18 StorageBuffer +%19 = OpVariable %18 StorageBuffer +%22 = OpTypePointer Input %11 +%21 = OpVariable %22 Input +%25 = OpTypeFunction %2 +%26 = OpTypePointer Uniform %8 +%27 = OpConstant %4 0 +%29 = OpConstant %5 0.0 +%30 = OpConstantComposite %6 %29 %29 +%31 = OpConstant %12 0 +%32 = OpConstant %12 1 +%33 = OpConstant %4 1 +%34 = OpConstant %5 0.1 +%35 = OpConstant %5 -1.0 +%36 = OpConstant %5 1.0 +%38 = OpTypePointer Function %6 +%39 = OpConstantNull %6 +%41 = OpConstantNull %6 +%46 = OpTypePointer Function %12 +%49 = OpConstantNull %6 +%51 = OpConstantNull %6 +%53 = OpTypePointer Function %4 +%56 = OpTypeBool +%60 = OpTypePointer StorageBuffer %9 +%61 = OpTypePointer StorageBuffer %7 +%62 = OpTypePointer StorageBuffer %6 +%88 = OpTypePointer Uniform %5 +%102 = OpConstant %4 2 +%116 = OpConstant %4 3 +%151 = OpConstant %4 4 +%157 = OpConstant %4 5 +%163 = OpConstant %4 6 +%180 = OpTypePointer Function %5 +%24 = OpFunction %2 None %25 +%20 = OpLabel +%52 = OpVariable %53 Function %27 +%47 = OpVariable %46 Function %31 +%43 = OpVariable %38 Function %30 +%37 = OpVariable %38 Function %39 +%48 = OpVariable %38 Function %49 +%44 = OpVariable %38 Function %30 +%40 = OpVariable %38 Function %41 +%50 = OpVariable %38 Function %51 +%45 = OpVariable %46 Function %31 +%42 = OpVariable %38 Function %30 +%23 = OpLoad %11 %21 +%28 = OpAccessChain %26 %14 %27 +OpBranch %54 +%54 = OpLabel +OpLine %3 29 21 +%55 = OpCompositeExtract %4 %23 0 +OpLine %3 30 6 +%57 = OpUGreaterThanEqual %56 %55 %13 +OpLine %3 30 3 +OpSelectionMerge %58 None +OpBranchConditional %57 %59 %58 +%59 = OpLabel OpReturn -%57 = OpLabel -%62 = OpAccessChain %61 %16 %26 %54 %26 -%63 = OpLoad %5 %62 -OpStore %36 %63 -%64 = OpAccessChain %61 %16 %26 %54 %32 -%65 = OpLoad %5 %64 -OpStore %39 %65 -OpBranch %66 -%66 = OpLabel -OpLoopMerge %67 %69 None -OpBranch %68 -%68 = OpLabel -%70 = OpLoad %3 %51 -%71 = OpUGreaterThanEqual %55 %70 %12 -OpSelectionMerge %72 None -OpBranchConditional %71 %73 %72 -%73 = OpLabel +%58 = OpLabel +OpLine %3 34 14 +%63 = OpAccessChain %62 %17 %27 %55 %27 +%64 = OpLoad %6 %63 +OpLine %3 34 3 +OpStore %37 %64 +OpLine %3 35 14 +%65 = OpAccessChain %62 %17 %27 %55 %33 +%66 = OpLoad %6 %65 +OpLine %3 35 3 +OpStore %40 %66 +OpLine %3 37 15 +OpLine %3 38 14 +OpLine %3 39 16 OpBranch %67 -%72 = OpLabel -%74 = OpLoad %3 %51 -%75 = OpIEqual %55 %74 %54 -OpSelectionMerge %76 None -OpBranchConditional %75 %77 %76 -%77 = OpLabel -OpBranch %69 -%76 = OpLabel -%78 = OpLoad %3 %51 -%79 = OpAccessChain %61 %16 %26 %78 %26 -%80 = OpLoad %5 %79 -OpStore %47 %80 -%81 = OpLoad %3 %51 -%82 = OpAccessChain %61 %16 %26 %81 %32 -%83 = OpLoad %5 %82 -OpStore %49 %83 -%84 = OpLoad %5 %47 -%85 = OpLoad %5 %36 -%86 = OpExtInst %4 %1 Distance %84 %85 -%88 = OpAccessChain %87 %27 %32 -%89 = OpLoad %4 %88 -%90 = OpFOrdLessThan %55 %86 %89 -OpSelectionMerge %91 None -OpBranchConditional %90 %92 %91 -%92 = OpLabel -%93 = OpLoad %5 %41 -%94 = OpLoad %5 %47 -%95 = OpFAdd %5 %93 %94 -OpStore %41 %95 -%96 = OpLoad %11 %44 -%97 = OpIAdd %11 %96 %31 -OpStore %44 %97 -OpBranch %91 -%91 = OpLabel -%98 = OpLoad %5 %47 -%99 = OpLoad %5 %36 -%100 = OpExtInst %4 %1 Distance %98 %99 -%102 = OpAccessChain %87 %27 %101 -%103 = OpLoad %4 %102 -%104 = OpFOrdLessThan %55 %100 %103 -OpSelectionMerge %105 None -OpBranchConditional %104 %106 %105 -%106 = OpLabel -%107 = OpLoad %5 %43 -%108 = OpLoad %5 %47 -%109 = OpLoad %5 %36 -%110 = OpFSub %5 %108 %109 -%111 = OpFSub %5 %107 %110 -OpStore %43 %111 -OpBranch %105 -%105 = OpLabel -%112 = OpLoad %5 %47 -%113 = OpLoad %5 %36 -%114 = OpExtInst %4 %1 Distance %112 %113 -%116 = OpAccessChain %87 %27 %115 -%117 = OpLoad %4 %116 -%118 = OpFOrdLessThan %55 %114 %117 -OpSelectionMerge %119 None -OpBranchConditional %118 %120 %119 -%120 = OpLabel -%121 = OpLoad %5 %42 -%122 = OpLoad %5 %49 -%123 = OpFAdd %5 %121 %122 -OpStore %42 %123 -%124 = OpLoad %11 %46 -%125 = OpIAdd %11 %124 %31 -OpStore %46 %125 -OpBranch %119 -%119 = OpLabel +%67 = OpLabel +OpLine %3 46 3 +OpLoopMerge %68 %70 None OpBranch %69 %69 = OpLabel -%126 = OpLoad %3 %51 -%127 = OpIAdd %3 %126 %32 -OpStore %51 %127 -OpBranch %66 -%67 = OpLabel -%128 = OpLoad %11 %44 -%129 = OpSGreaterThan %55 %128 %30 -OpSelectionMerge %130 None -OpBranchConditional %129 %131 %130 +OpLine %3 1 1 +%71 = OpLoad %4 %52 +OpLine %3 47 8 +%72 = OpUGreaterThanEqual %56 %71 %13 +OpLine %3 47 5 +OpSelectionMerge %73 None +OpBranchConditional %72 %74 %73 +%74 = OpLabel +OpBranch %68 +%73 = OpLabel +OpLine %3 50 8 +%75 = OpLoad %4 %52 +%76 = OpIEqual %56 %75 %55 +OpLine %3 50 5 +OpSelectionMerge %77 None +OpBranchConditional %76 %78 %77 +%78 = OpLabel +OpBranch %70 +%77 = OpLabel +OpLine %3 54 11 +%79 = OpLoad %4 %52 +%80 = OpAccessChain %62 %17 %27 %79 %27 +%81 = OpLoad %6 %80 +OpLine %3 54 5 +OpStore %48 %81 +OpLine %3 55 11 +%82 = OpLoad %4 %52 +%83 = OpAccessChain %62 %17 %27 %82 %33 +%84 = OpLoad %6 %83 +OpLine %3 55 5 +OpStore %50 %84 +OpLine %3 57 8 +%85 = OpLoad %6 %48 +%86 = OpLoad %6 %37 +%87 = OpExtInst %5 %1 Distance %85 %86 +OpLine %3 57 8 +%89 = OpAccessChain %88 %28 %33 +%90 = OpLoad %5 %89 +%91 = OpFOrdLessThan %56 %87 %90 +OpLine %3 57 5 +OpSelectionMerge %92 None +OpBranchConditional %91 %93 %92 +%93 = OpLabel +OpLine %3 58 15 +%94 = OpLoad %6 %42 +%95 = OpLoad %6 %48 +%96 = OpFAdd %6 %94 %95 +OpLine %3 58 7 +OpStore %42 %96 +OpLine %3 1 1 +%97 = OpLoad %12 %45 +OpLine %3 59 20 +%98 = OpIAdd %12 %97 %32 +OpLine %3 59 7 +OpStore %45 %98 +OpBranch %92 +%92 = OpLabel +OpLine %3 61 8 +%99 = OpLoad %6 %48 +%100 = OpLoad %6 %37 +%101 = OpExtInst %5 %1 Distance %99 %100 +OpLine %3 61 8 +%103 = OpAccessChain %88 %28 %102 +%104 = OpLoad %5 %103 +%105 = OpFOrdLessThan %56 %101 %104 +OpLine %3 61 5 +OpSelectionMerge %106 None +OpBranchConditional %105 %107 %106 +%107 = OpLabel +OpLine %3 62 16 +%108 = OpLoad %6 %44 +%109 = OpLoad %6 %48 +%110 = OpLoad %6 %37 +%111 = OpFSub %6 %109 %110 +%112 = OpFSub %6 %108 %111 +OpLine %3 62 7 +OpStore %44 %112 +OpBranch %106 +%106 = OpLabel +OpLine %3 64 8 +%113 = OpLoad %6 %48 +%114 = OpLoad %6 %37 +%115 = OpExtInst %5 %1 Distance %113 %114 +OpLine %3 64 8 +%117 = OpAccessChain %88 %28 %116 +%118 = OpLoad %5 %117 +%119 = OpFOrdLessThan %56 %115 %118 +OpLine %3 64 5 +OpSelectionMerge %120 None +OpBranchConditional %119 %121 %120 +%121 = OpLabel +OpLine %3 65 14 +%122 = OpLoad %6 %43 +%123 = OpLoad %6 %50 +%124 = OpFAdd %6 %122 %123 +OpLine %3 65 7 +OpStore %43 %124 +OpLine %3 1 1 +%125 = OpLoad %12 %47 +OpLine %3 66 19 +%126 = OpIAdd %12 %125 %32 +OpLine %3 66 7 +OpStore %47 %126 +OpBranch %120 +%120 = OpLabel +OpBranch %70 +%70 = OpLabel +OpLine %3 1 1 +%127 = OpLoad %4 %52 +OpLine %3 70 11 +%128 = OpIAdd %4 %127 %33 +OpLine %3 70 7 +OpStore %52 %128 +OpBranch %67 +%68 = OpLabel +OpLine %3 1 1 +%129 = OpLoad %12 %45 +OpLine %3 73 6 +%130 = OpSGreaterThan %56 %129 %31 +OpLine %3 73 3 +OpSelectionMerge %131 None +OpBranchConditional %130 %132 %131 +%132 = OpLabel +OpLine %3 74 13 +%133 = OpLoad %6 %42 +%134 = OpLoad %12 %45 +%135 = OpConvertSToF %5 %134 +%136 = OpCompositeConstruct %6 %135 %135 +%137 = OpFDiv %6 %133 %136 +%138 = OpLoad %6 %37 +%139 = OpFSub %6 %137 %138 +OpLine %3 74 5 +OpStore %42 %139 +OpBranch %131 %131 = OpLabel -%132 = OpLoad %5 %41 -%133 = OpLoad %11 %44 -%134 = OpConvertSToF %4 %133 -%135 = OpCompositeConstruct %5 %134 %134 -%136 = OpFDiv %5 %132 %135 -%137 = OpLoad %5 %36 -%138 = OpFSub %5 %136 %137 -OpStore %41 %138 -OpBranch %130 -%130 = OpLabel -%139 = OpLoad %11 %46 -%140 = OpSGreaterThan %55 %139 %30 -OpSelectionMerge %141 None -OpBranchConditional %140 %142 %141 +OpLine %3 1 1 +%140 = OpLoad %12 %47 +OpLine %3 76 6 +%141 = OpSGreaterThan %56 %140 %31 +OpLine %3 76 3 +OpSelectionMerge %142 None +OpBranchConditional %141 %143 %142 +%143 = OpLabel +OpLine %3 77 12 +%144 = OpLoad %6 %43 +%145 = OpLoad %12 %47 +%146 = OpConvertSToF %5 %145 +%147 = OpCompositeConstruct %6 %146 %146 +%148 = OpFDiv %6 %144 %147 +OpLine %3 77 5 +OpStore %43 %148 +OpBranch %142 %142 = OpLabel -%143 = OpLoad %5 %42 -%144 = OpLoad %11 %46 -%145 = OpConvertSToF %4 %144 -%146 = OpCompositeConstruct %5 %145 %145 -%147 = OpFDiv %5 %143 %146 -OpStore %42 %147 -OpBranch %141 -%141 = OpLabel -%148 = OpLoad %5 %39 -%149 = OpLoad %5 %41 -%151 = OpAccessChain %87 %27 %150 -%152 = OpLoad %4 %151 -%153 = OpVectorTimesScalar %5 %149 %152 -%154 = OpFAdd %5 %148 %153 -%155 = OpLoad %5 %43 -%157 = OpAccessChain %87 %27 %156 -%158 = OpLoad %4 %157 -%159 = OpVectorTimesScalar %5 %155 %158 -%160 = OpFAdd %5 %154 %159 -%161 = OpLoad %5 %42 -%163 = OpAccessChain %87 %27 %162 -%164 = OpLoad %4 %163 -%165 = OpVectorTimesScalar %5 %161 %164 -%166 = OpFAdd %5 %160 %165 -OpStore %39 %166 -%167 = OpLoad %5 %39 -%168 = OpExtInst %5 %1 Normalize %167 -%169 = OpLoad %5 %39 -%170 = OpExtInst %4 %1 Length %169 -%171 = OpExtInst %4 %1 FClamp %170 %28 %33 -%172 = OpVectorTimesScalar %5 %168 %171 -OpStore %39 %172 -%173 = OpLoad %5 %36 -%174 = OpLoad %5 %39 -%175 = OpAccessChain %87 %27 %26 -%176 = OpLoad %4 %175 -%177 = OpVectorTimesScalar %5 %174 %176 -%178 = OpFAdd %5 %173 %177 -OpStore %36 %178 -%180 = OpAccessChain %179 %36 %26 -%181 = OpLoad %4 %180 -%182 = OpFOrdLessThan %55 %181 %34 -OpSelectionMerge %183 None -OpBranchConditional %182 %184 %183 +OpLine %3 1 1 +%149 = OpLoad %6 %40 +%150 = OpLoad %6 %42 +OpLine %3 80 10 +%152 = OpAccessChain %88 %28 %151 +%153 = OpLoad %5 %152 +%154 = OpVectorTimesScalar %6 %150 %153 +%155 = OpFAdd %6 %149 %154 +%156 = OpLoad %6 %44 +OpLine %3 80 10 +%158 = OpAccessChain %88 %28 %157 +%159 = OpLoad %5 %158 +%160 = OpVectorTimesScalar %6 %156 %159 +%161 = OpFAdd %6 %155 %160 +%162 = OpLoad %6 %43 +OpLine %3 80 10 +%164 = OpAccessChain %88 %28 %163 +%165 = OpLoad %5 %164 +%166 = OpVectorTimesScalar %6 %162 %165 +%167 = OpFAdd %6 %161 %166 +OpLine %3 80 3 +OpStore %40 %167 +OpLine %3 85 10 +%168 = OpLoad %6 %40 +%169 = OpExtInst %6 %1 Normalize %168 +%170 = OpLoad %6 %40 +%171 = OpExtInst %5 %1 Length %170 +OpLine %3 85 10 +%172 = OpExtInst %5 %1 FClamp %171 %29 %34 +%173 = OpVectorTimesScalar %6 %169 %172 +OpLine %3 85 3 +OpStore %40 %173 +OpLine %3 1 1 +%174 = OpLoad %6 %37 +%175 = OpLoad %6 %40 +OpLine %3 88 10 +%176 = OpAccessChain %88 %28 %27 +%177 = OpLoad %5 %176 +%178 = OpVectorTimesScalar %6 %175 %177 +%179 = OpFAdd %6 %174 %178 +OpLine %3 88 3 +OpStore %37 %179 +OpLine %3 91 6 +%181 = OpAccessChain %180 %37 %27 +%182 = OpLoad %5 %181 +OpLine %3 91 6 +%183 = OpFOrdLessThan %56 %182 %35 +OpLine %3 91 3 +OpSelectionMerge %184 None +OpBranchConditional %183 %185 %184 +%185 = OpLabel +OpLine %3 92 5 +OpLine %3 92 5 +%186 = OpAccessChain %180 %37 %27 +OpStore %186 %36 +OpBranch %184 %184 = OpLabel -%185 = OpAccessChain %179 %36 %26 -OpStore %185 %35 -OpBranch %183 -%183 = OpLabel -%186 = OpAccessChain %179 %36 %26 -%187 = OpLoad %4 %186 -%188 = OpFOrdGreaterThan %55 %187 %35 -OpSelectionMerge %189 None -OpBranchConditional %188 %190 %189 +OpLine %3 94 6 +%187 = OpAccessChain %180 %37 %27 +%188 = OpLoad %5 %187 +OpLine %3 94 6 +%189 = OpFOrdGreaterThan %56 %188 %36 +OpLine %3 94 3 +OpSelectionMerge %190 None +OpBranchConditional %189 %191 %190 +%191 = OpLabel +OpLine %3 95 5 +OpLine %3 95 5 +%192 = OpAccessChain %180 %37 %27 +OpStore %192 %35 +OpBranch %190 %190 = OpLabel -%191 = OpAccessChain %179 %36 %26 -OpStore %191 %34 -OpBranch %189 -%189 = OpLabel -%192 = OpAccessChain %179 %36 %32 -%193 = OpLoad %4 %192 -%194 = OpFOrdLessThan %55 %193 %34 -OpSelectionMerge %195 None -OpBranchConditional %194 %196 %195 +OpLine %3 97 6 +%193 = OpAccessChain %180 %37 %33 +%194 = OpLoad %5 %193 +OpLine %3 97 6 +%195 = OpFOrdLessThan %56 %194 %35 +OpLine %3 97 3 +OpSelectionMerge %196 None +OpBranchConditional %195 %197 %196 +%197 = OpLabel +OpLine %3 98 5 +OpLine %3 98 5 +%198 = OpAccessChain %180 %37 %33 +OpStore %198 %36 +OpBranch %196 %196 = OpLabel -%197 = OpAccessChain %179 %36 %32 -OpStore %197 %35 -OpBranch %195 -%195 = OpLabel -%198 = OpAccessChain %179 %36 %32 -%199 = OpLoad %4 %198 -%200 = OpFOrdGreaterThan %55 %199 %35 -OpSelectionMerge %201 None -OpBranchConditional %200 %202 %201 +OpLine %3 100 6 +%199 = OpAccessChain %180 %37 %33 +%200 = OpLoad %5 %199 +OpLine %3 100 6 +%201 = OpFOrdGreaterThan %56 %200 %36 +OpLine %3 100 3 +OpSelectionMerge %202 None +OpBranchConditional %201 %203 %202 +%203 = OpLabel +OpLine %3 101 5 +OpLine %3 101 5 +%204 = OpAccessChain %180 %37 %33 +OpStore %204 %35 +OpBranch %202 %202 = OpLabel -%203 = OpAccessChain %179 %36 %32 -OpStore %203 %34 -OpBranch %201 -%201 = OpLabel -%204 = OpLoad %5 %36 -%205 = OpAccessChain %61 %18 %26 %54 %26 -OpStore %205 %204 -%206 = OpLoad %5 %39 -%207 = OpAccessChain %61 %18 %26 %54 %32 -OpStore %207 %206 +OpLine %3 105 3 +%205 = OpLoad %6 %37 +OpLine %3 105 3 +%206 = OpAccessChain %62 %19 %27 %55 %27 +OpStore %206 %205 +OpLine %3 106 3 +%207 = OpLoad %6 %40 +OpLine %3 106 3 +%208 = OpAccessChain %62 %19 %27 %55 %33 +OpStore %208 %207 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/bounds-check-image-restrict.spvasm b/naga/tests/out/spv/bounds-check-image-restrict.spvasm index 7837602e08..61d7450c9c 100644 --- a/naga/tests/out/spv/bounds-check-image-restrict.spvasm +++ b/naga/tests/out/spv/bounds-check-image-restrict.spvasm @@ -1,437 +1,585 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 280 +; Bound: 281 OpCapability Shader OpCapability Sampled1D OpCapability Image1D OpCapability ImageQuery %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %250 "fragment_shader" %248 -OpExecutionMode %250 OriginUpperLeft -OpName %21 "image_1d" -OpName %23 "image_2d" -OpName %25 "image_2d_array" -OpName %27 "image_3d" -OpName %29 "image_multisampled_2d" -OpName %31 "image_depth_2d" -OpName %33 "image_depth_2d_array" -OpName %35 "image_depth_multisampled_2d" -OpName %37 "image_storage_1d" -OpName %39 "image_storage_2d" -OpName %41 "image_storage_2d_array" -OpName %43 "image_storage_3d" -OpName %46 "coords" -OpName %47 "level" -OpName %48 "test_textureLoad_1d" -OpName %61 "coords" -OpName %62 "level" -OpName %63 "test_textureLoad_2d" -OpName %76 "coords" -OpName %77 "index" -OpName %78 "level" -OpName %79 "test_textureLoad_2d_array_u" -OpName %94 "coords" -OpName %95 "index" -OpName %96 "level" -OpName %97 "test_textureLoad_2d_array_s" -OpName %111 "coords" -OpName %112 "level" -OpName %113 "test_textureLoad_3d" -OpName %126 "coords" -OpName %127 "_sample" -OpName %128 "test_textureLoad_multisampled_2d" -OpName %140 "coords" -OpName %141 "level" -OpName %142 "test_textureLoad_depth_2d" -OpName %156 "coords" -OpName %157 "index" -OpName %158 "level" -OpName %159 "test_textureLoad_depth_2d_array_u" -OpName %175 "coords" -OpName %176 "index" -OpName %177 "level" -OpName %178 "test_textureLoad_depth_2d_array_s" -OpName %193 "coords" -OpName %194 "_sample" -OpName %195 "test_textureLoad_depth_multisampled_2d" -OpName %208 "coords" -OpName %209 "value" -OpName %210 "test_textureStore_1d" -OpName %215 "coords" -OpName %216 "value" -OpName %217 "test_textureStore_2d" -OpName %222 "coords" -OpName %223 "array_index" -OpName %224 "value" -OpName %225 "test_textureStore_2d_array_u" -OpName %232 "coords" -OpName %233 "array_index" -OpName %234 "value" -OpName %235 "test_textureStore_2d_array_s" -OpName %241 "coords" -OpName %242 "value" -OpName %243 "test_textureStore_3d" -OpName %250 "fragment_shader" -OpDecorate %21 DescriptorSet 0 -OpDecorate %21 Binding 0 -OpDecorate %23 DescriptorSet 0 -OpDecorate %23 Binding 1 -OpDecorate %25 DescriptorSet 0 -OpDecorate %25 Binding 2 -OpDecorate %27 DescriptorSet 0 -OpDecorate %27 Binding 3 -OpDecorate %29 DescriptorSet 0 -OpDecorate %29 Binding 4 -OpDecorate %31 DescriptorSet 0 -OpDecorate %31 Binding 5 -OpDecorate %33 DescriptorSet 0 -OpDecorate %33 Binding 6 -OpDecorate %35 DescriptorSet 0 -OpDecorate %35 Binding 7 -OpDecorate %37 NonReadable -OpDecorate %37 DescriptorSet 0 -OpDecorate %37 Binding 8 -OpDecorate %39 NonReadable -OpDecorate %39 DescriptorSet 0 -OpDecorate %39 Binding 9 -OpDecorate %41 NonReadable -OpDecorate %41 DescriptorSet 0 -OpDecorate %41 Binding 10 -OpDecorate %43 NonReadable -OpDecorate %43 DescriptorSet 0 -OpDecorate %43 Binding 11 -OpDecorate %248 Location 0 +OpEntryPoint Fragment %251 "fragment_shader" %249 +OpExecutionMode %251 OriginUpperLeft +%3 = OpString "bounds-check-image-restrict.wgsl" +OpSource Unknown 0 %3 "@group(0) @binding(0) +var image_1d: texture_1d; + +fn test_textureLoad_1d(coords: i32, level: i32) -> vec4 { + return textureLoad(image_1d, coords, level); +} + +@group(0) @binding(1) +var image_2d: texture_2d; + +fn test_textureLoad_2d(coords: vec2, level: i32) -> vec4 { + return textureLoad(image_2d, coords, level); +} + +@group(0) @binding(2) +var image_2d_array: texture_2d_array; + +fn test_textureLoad_2d_array_u(coords: vec2, index: u32, level: i32) -> vec4 { + return textureLoad(image_2d_array, coords, index, level); +} + +fn test_textureLoad_2d_array_s(coords: vec2, index: i32, level: i32) -> vec4 { + return textureLoad(image_2d_array, coords, index, level); +} + +@group(0) @binding(3) +var image_3d: texture_3d; + +fn test_textureLoad_3d(coords: vec3, level: i32) -> vec4 { + return textureLoad(image_3d, coords, level); +} + +@group(0) @binding(4) +var image_multisampled_2d: texture_multisampled_2d; + +fn test_textureLoad_multisampled_2d(coords: vec2, _sample: i32) -> vec4 { + return textureLoad(image_multisampled_2d, coords, _sample); +} + +@group(0) @binding(5) +var image_depth_2d: texture_depth_2d; + +fn test_textureLoad_depth_2d(coords: vec2, level: i32) -> f32 { + return textureLoad(image_depth_2d, coords, level); +} + +@group(0) @binding(6) +var image_depth_2d_array: texture_depth_2d_array; + +fn test_textureLoad_depth_2d_array_u(coords: vec2, index: u32, level: i32) -> f32 { + return textureLoad(image_depth_2d_array, coords, index, level); +} + +fn test_textureLoad_depth_2d_array_s(coords: vec2, index: i32, level: i32) -> f32 { + return textureLoad(image_depth_2d_array, coords, index, level); +} + +@group(0) @binding(7) +var image_depth_multisampled_2d: texture_depth_multisampled_2d; + +fn test_textureLoad_depth_multisampled_2d(coords: vec2, _sample: i32) -> f32 { + return textureLoad(image_depth_multisampled_2d, coords, _sample); +} + +@group(0) @binding(8) +var image_storage_1d: texture_storage_1d; + +fn test_textureStore_1d(coords: i32, value: vec4) { + textureStore(image_storage_1d, coords, value); +} + +@group(0) @binding(9) +var image_storage_2d: texture_storage_2d; + +fn test_textureStore_2d(coords: vec2, value: vec4) { + textureStore(image_storage_2d, coords, value); +} + +@group(0) @binding(10) +var image_storage_2d_array: texture_storage_2d_array; + +fn test_textureStore_2d_array_u(coords: vec2, array_index: u32, value: vec4) { + textureStore(image_storage_2d_array, coords, array_index, value); +} + +fn test_textureStore_2d_array_s(coords: vec2, array_index: i32, value: vec4) { + textureStore(image_storage_2d_array, coords, array_index, value); +} + +@group(0) @binding(11) +var image_storage_3d: texture_storage_3d; + +fn test_textureStore_3d(coords: vec3, value: vec4) { + textureStore(image_storage_3d, coords, value); +} + +// GLSL output requires that we identify an entry point, so +// that it can tell what \"in\" and \"out\" globals to write. +@fragment +fn fragment_shader() -> @location(0) vec4 { + test_textureLoad_1d(0, 0); + test_textureLoad_2d(vec2(), 0); + test_textureLoad_2d_array_u(vec2(), 0u, 0); + test_textureLoad_2d_array_s(vec2(), 0, 0); + test_textureLoad_3d(vec3(), 0); + test_textureLoad_multisampled_2d(vec2(), 0); + // Not yet implemented for GLSL: + // test_textureLoad_depth_2d(vec2(), 0); + // test_textureLoad_depth_2d_array_u(vec2(), 0u, 0); + // test_textureLoad_depth_2d_array_s(vec2(), 0, 0); + // test_textureLoad_depth_multisampled_2d(vec2(), 0); + test_textureStore_1d(0, vec4()); + test_textureStore_2d(vec2(), vec4()); + test_textureStore_2d_array_u(vec2(), 0u, vec4()); + test_textureStore_2d_array_s(vec2(), 0, vec4()); + test_textureStore_3d(vec3(), vec4()); + + return vec4(0.,0.,0.,0.); +} +" +OpName %22 "image_1d" +OpName %24 "image_2d" +OpName %26 "image_2d_array" +OpName %28 "image_3d" +OpName %30 "image_multisampled_2d" +OpName %32 "image_depth_2d" +OpName %34 "image_depth_2d_array" +OpName %36 "image_depth_multisampled_2d" +OpName %38 "image_storage_1d" +OpName %40 "image_storage_2d" +OpName %42 "image_storage_2d_array" +OpName %44 "image_storage_3d" +OpName %47 "coords" +OpName %48 "level" +OpName %49 "test_textureLoad_1d" +OpName %62 "coords" +OpName %63 "level" +OpName %64 "test_textureLoad_2d" +OpName %77 "coords" +OpName %78 "index" +OpName %79 "level" +OpName %80 "test_textureLoad_2d_array_u" +OpName %95 "coords" +OpName %96 "index" +OpName %97 "level" +OpName %98 "test_textureLoad_2d_array_s" +OpName %112 "coords" +OpName %113 "level" +OpName %114 "test_textureLoad_3d" +OpName %127 "coords" +OpName %128 "_sample" +OpName %129 "test_textureLoad_multisampled_2d" +OpName %141 "coords" +OpName %142 "level" +OpName %143 "test_textureLoad_depth_2d" +OpName %157 "coords" +OpName %158 "index" +OpName %159 "level" +OpName %160 "test_textureLoad_depth_2d_array_u" +OpName %176 "coords" +OpName %177 "index" +OpName %178 "level" +OpName %179 "test_textureLoad_depth_2d_array_s" +OpName %194 "coords" +OpName %195 "_sample" +OpName %196 "test_textureLoad_depth_multisampled_2d" +OpName %209 "coords" +OpName %210 "value" +OpName %211 "test_textureStore_1d" +OpName %216 "coords" +OpName %217 "value" +OpName %218 "test_textureStore_2d" +OpName %223 "coords" +OpName %224 "array_index" +OpName %225 "value" +OpName %226 "test_textureStore_2d_array_u" +OpName %233 "coords" +OpName %234 "array_index" +OpName %235 "value" +OpName %236 "test_textureStore_2d_array_s" +OpName %242 "coords" +OpName %243 "value" +OpName %244 "test_textureStore_3d" +OpName %251 "fragment_shader" +OpDecorate %22 DescriptorSet 0 +OpDecorate %22 Binding 0 +OpDecorate %24 DescriptorSet 0 +OpDecorate %24 Binding 1 +OpDecorate %26 DescriptorSet 0 +OpDecorate %26 Binding 2 +OpDecorate %28 DescriptorSet 0 +OpDecorate %28 Binding 3 +OpDecorate %30 DescriptorSet 0 +OpDecorate %30 Binding 4 +OpDecorate %32 DescriptorSet 0 +OpDecorate %32 Binding 5 +OpDecorate %34 DescriptorSet 0 +OpDecorate %34 Binding 6 +OpDecorate %36 DescriptorSet 0 +OpDecorate %36 Binding 7 +OpDecorate %38 NonReadable +OpDecorate %38 DescriptorSet 0 +OpDecorate %38 Binding 8 +OpDecorate %40 NonReadable +OpDecorate %40 DescriptorSet 0 +OpDecorate %40 Binding 9 +OpDecorate %42 NonReadable +OpDecorate %42 DescriptorSet 0 +OpDecorate %42 Binding 10 +OpDecorate %44 NonReadable +OpDecorate %44 DescriptorSet 0 +OpDecorate %44 Binding 11 +OpDecorate %249 Location 0 %2 = OpTypeVoid -%4 = OpTypeFloat 32 -%3 = OpTypeImage %4 1D 0 0 0 1 Unknown -%5 = OpTypeInt 32 1 -%6 = OpTypeVector %4 4 -%7 = OpTypeImage %4 2D 0 0 0 1 Unknown -%8 = OpTypeVector %5 2 -%9 = OpTypeImage %4 2D 0 1 0 1 Unknown -%10 = OpTypeInt 32 0 -%11 = OpTypeImage %4 3D 0 0 0 1 Unknown -%12 = OpTypeVector %5 3 -%13 = OpTypeImage %4 2D 0 0 1 1 Unknown -%14 = OpTypeImage %4 2D 1 0 0 1 Unknown -%15 = OpTypeImage %4 2D 1 1 0 1 Unknown -%16 = OpTypeImage %4 2D 1 0 1 1 Unknown -%17 = OpTypeImage %4 1D 0 0 0 2 Rgba8 -%18 = OpTypeImage %4 2D 0 0 0 2 Rgba8 -%19 = OpTypeImage %4 2D 0 1 0 2 Rgba8 -%20 = OpTypeImage %4 3D 0 0 0 2 Rgba8 -%22 = OpTypePointer UniformConstant %3 -%21 = OpVariable %22 UniformConstant -%24 = OpTypePointer UniformConstant %7 -%23 = OpVariable %24 UniformConstant -%26 = OpTypePointer UniformConstant %9 -%25 = OpVariable %26 UniformConstant -%28 = OpTypePointer UniformConstant %11 -%27 = OpVariable %28 UniformConstant -%30 = OpTypePointer UniformConstant %13 -%29 = OpVariable %30 UniformConstant -%32 = OpTypePointer UniformConstant %14 -%31 = OpVariable %32 UniformConstant -%34 = OpTypePointer UniformConstant %15 -%33 = OpVariable %34 UniformConstant -%36 = OpTypePointer UniformConstant %16 -%35 = OpVariable %36 UniformConstant -%38 = OpTypePointer UniformConstant %17 -%37 = OpVariable %38 UniformConstant -%40 = OpTypePointer UniformConstant %18 -%39 = OpVariable %40 UniformConstant -%42 = OpTypePointer UniformConstant %19 -%41 = OpVariable %42 UniformConstant -%44 = OpTypePointer UniformConstant %20 -%43 = OpVariable %44 UniformConstant -%49 = OpTypeFunction %6 %5 %5 -%53 = OpConstant %5 1 -%64 = OpTypeFunction %6 %8 %5 -%71 = OpConstantComposite %8 %53 %53 -%80 = OpTypeFunction %6 %8 %10 %5 -%89 = OpConstantComposite %12 %53 %53 %53 -%98 = OpTypeFunction %6 %8 %5 %5 -%106 = OpConstantComposite %12 %53 %53 %53 -%114 = OpTypeFunction %6 %12 %5 -%121 = OpConstantComposite %12 %53 %53 %53 -%135 = OpConstantComposite %8 %53 %53 -%143 = OpTypeFunction %4 %8 %5 -%150 = OpConstantComposite %8 %53 %53 -%160 = OpTypeFunction %4 %8 %10 %5 -%169 = OpConstantComposite %12 %53 %53 %53 -%179 = OpTypeFunction %4 %8 %5 %5 -%187 = OpConstantComposite %12 %53 %53 %53 -%202 = OpConstantComposite %8 %53 %53 -%211 = OpTypeFunction %2 %5 %6 -%218 = OpTypeFunction %2 %8 %6 -%226 = OpTypeFunction %2 %8 %10 %6 -%236 = OpTypeFunction %2 %8 %5 %6 -%244 = OpTypeFunction %2 %12 %6 -%249 = OpTypePointer Output %6 -%248 = OpVariable %249 Output -%251 = OpTypeFunction %2 -%261 = OpConstant %5 0 -%262 = OpConstantNull %8 -%263 = OpConstant %10 0 -%264 = OpConstantNull %12 -%265 = OpConstantNull %6 -%266 = OpConstant %4 0.0 -%267 = OpConstantComposite %6 %266 %266 %266 %266 -%48 = OpFunction %6 None %49 -%46 = OpFunctionParameter %5 -%47 = OpFunctionParameter %5 -%45 = OpLabel -%50 = OpLoad %3 %21 -OpBranch %51 -%51 = OpLabel -%52 = OpImageQueryLevels %5 %50 -%54 = OpISub %5 %52 %53 -%55 = OpExtInst %5 %1 UMin %47 %54 -%56 = OpImageQuerySizeLod %5 %50 %55 -%57 = OpISub %5 %56 %53 -%58 = OpExtInst %5 %1 UMin %46 %57 -%59 = OpImageFetch %6 %50 %58 Lod %55 -OpReturnValue %59 +%5 = OpTypeFloat 32 +%4 = OpTypeImage %5 1D 0 0 0 1 Unknown +%6 = OpTypeInt 32 1 +%7 = OpTypeVector %5 4 +%8 = OpTypeImage %5 2D 0 0 0 1 Unknown +%9 = OpTypeVector %6 2 +%10 = OpTypeImage %5 2D 0 1 0 1 Unknown +%11 = OpTypeInt 32 0 +%12 = OpTypeImage %5 3D 0 0 0 1 Unknown +%13 = OpTypeVector %6 3 +%14 = OpTypeImage %5 2D 0 0 1 1 Unknown +%15 = OpTypeImage %5 2D 1 0 0 1 Unknown +%16 = OpTypeImage %5 2D 1 1 0 1 Unknown +%17 = OpTypeImage %5 2D 1 0 1 1 Unknown +%18 = OpTypeImage %5 1D 0 0 0 2 Rgba8 +%19 = OpTypeImage %5 2D 0 0 0 2 Rgba8 +%20 = OpTypeImage %5 2D 0 1 0 2 Rgba8 +%21 = OpTypeImage %5 3D 0 0 0 2 Rgba8 +%23 = OpTypePointer UniformConstant %4 +%22 = OpVariable %23 UniformConstant +%25 = OpTypePointer UniformConstant %8 +%24 = OpVariable %25 UniformConstant +%27 = OpTypePointer UniformConstant %10 +%26 = OpVariable %27 UniformConstant +%29 = OpTypePointer UniformConstant %12 +%28 = OpVariable %29 UniformConstant +%31 = OpTypePointer UniformConstant %14 +%30 = OpVariable %31 UniformConstant +%33 = OpTypePointer UniformConstant %15 +%32 = OpVariable %33 UniformConstant +%35 = OpTypePointer UniformConstant %16 +%34 = OpVariable %35 UniformConstant +%37 = OpTypePointer UniformConstant %17 +%36 = OpVariable %37 UniformConstant +%39 = OpTypePointer UniformConstant %18 +%38 = OpVariable %39 UniformConstant +%41 = OpTypePointer UniformConstant %19 +%40 = OpVariable %41 UniformConstant +%43 = OpTypePointer UniformConstant %20 +%42 = OpVariable %43 UniformConstant +%45 = OpTypePointer UniformConstant %21 +%44 = OpVariable %45 UniformConstant +%50 = OpTypeFunction %7 %6 %6 +%54 = OpConstant %6 1 +%65 = OpTypeFunction %7 %9 %6 +%72 = OpConstantComposite %9 %54 %54 +%81 = OpTypeFunction %7 %9 %11 %6 +%90 = OpConstantComposite %13 %54 %54 %54 +%99 = OpTypeFunction %7 %9 %6 %6 +%107 = OpConstantComposite %13 %54 %54 %54 +%115 = OpTypeFunction %7 %13 %6 +%122 = OpConstantComposite %13 %54 %54 %54 +%136 = OpConstantComposite %9 %54 %54 +%144 = OpTypeFunction %5 %9 %6 +%151 = OpConstantComposite %9 %54 %54 +%161 = OpTypeFunction %5 %9 %11 %6 +%170 = OpConstantComposite %13 %54 %54 %54 +%180 = OpTypeFunction %5 %9 %6 %6 +%188 = OpConstantComposite %13 %54 %54 %54 +%203 = OpConstantComposite %9 %54 %54 +%212 = OpTypeFunction %2 %6 %7 +%219 = OpTypeFunction %2 %9 %7 +%227 = OpTypeFunction %2 %9 %11 %7 +%237 = OpTypeFunction %2 %9 %6 %7 +%245 = OpTypeFunction %2 %13 %7 +%250 = OpTypePointer Output %7 +%249 = OpVariable %250 Output +%252 = OpTypeFunction %2 +%262 = OpConstant %6 0 +%263 = OpConstantNull %9 +%264 = OpConstant %11 0 +%265 = OpConstantNull %13 +%266 = OpConstantNull %7 +%267 = OpConstant %5 0.0 +%268 = OpConstantComposite %7 %267 %267 %267 %267 +%49 = OpFunction %7 None %50 +%47 = OpFunctionParameter %6 +%48 = OpFunctionParameter %6 +%46 = OpLabel +%51 = OpLoad %4 %22 +OpBranch %52 +%52 = OpLabel +OpLine %3 5 11 +%53 = OpImageQueryLevels %6 %51 +%55 = OpISub %6 %53 %54 +%56 = OpExtInst %6 %1 UMin %48 %55 +%57 = OpImageQuerySizeLod %6 %51 %56 +%58 = OpISub %6 %57 %54 +%59 = OpExtInst %6 %1 UMin %47 %58 +%60 = OpImageFetch %7 %51 %59 Lod %56 +OpReturnValue %60 OpFunctionEnd -%63 = OpFunction %6 None %64 -%61 = OpFunctionParameter %8 -%62 = OpFunctionParameter %5 -%60 = OpLabel -%65 = OpLoad %7 %23 -OpBranch %66 -%66 = OpLabel -%67 = OpImageQueryLevels %5 %65 -%68 = OpISub %5 %67 %53 -%69 = OpExtInst %5 %1 UMin %62 %68 -%70 = OpImageQuerySizeLod %8 %65 %69 -%72 = OpISub %8 %70 %71 -%73 = OpExtInst %8 %1 UMin %61 %72 -%74 = OpImageFetch %6 %65 %73 Lod %69 -OpReturnValue %74 +%64 = OpFunction %7 None %65 +%62 = OpFunctionParameter %9 +%63 = OpFunctionParameter %6 +%61 = OpLabel +%66 = OpLoad %8 %24 +OpBranch %67 +%67 = OpLabel +OpLine %3 12 11 +%68 = OpImageQueryLevels %6 %66 +%69 = OpISub %6 %68 %54 +%70 = OpExtInst %6 %1 UMin %63 %69 +%71 = OpImageQuerySizeLod %9 %66 %70 +%73 = OpISub %9 %71 %72 +%74 = OpExtInst %9 %1 UMin %62 %73 +%75 = OpImageFetch %7 %66 %74 Lod %70 +OpReturnValue %75 OpFunctionEnd -%79 = OpFunction %6 None %80 -%76 = OpFunctionParameter %8 -%77 = OpFunctionParameter %10 -%78 = OpFunctionParameter %5 -%75 = OpLabel -%81 = OpLoad %9 %25 -OpBranch %82 -%82 = OpLabel -%83 = OpBitcast %5 %77 -%84 = OpCompositeConstruct %12 %76 %83 -%85 = OpImageQueryLevels %5 %81 -%86 = OpISub %5 %85 %53 -%87 = OpExtInst %5 %1 UMin %78 %86 -%88 = OpImageQuerySizeLod %12 %81 %87 -%90 = OpISub %12 %88 %89 -%91 = OpExtInst %12 %1 UMin %84 %90 -%92 = OpImageFetch %6 %81 %91 Lod %87 -OpReturnValue %92 +%80 = OpFunction %7 None %81 +%77 = OpFunctionParameter %9 +%78 = OpFunctionParameter %11 +%79 = OpFunctionParameter %6 +%76 = OpLabel +%82 = OpLoad %10 %26 +OpBranch %83 +%83 = OpLabel +OpLine %3 19 11 +%84 = OpBitcast %6 %78 +%85 = OpCompositeConstruct %13 %77 %84 +%86 = OpImageQueryLevels %6 %82 +%87 = OpISub %6 %86 %54 +%88 = OpExtInst %6 %1 UMin %79 %87 +%89 = OpImageQuerySizeLod %13 %82 %88 +%91 = OpISub %13 %89 %90 +%92 = OpExtInst %13 %1 UMin %85 %91 +%93 = OpImageFetch %7 %82 %92 Lod %88 +OpReturnValue %93 OpFunctionEnd -%97 = OpFunction %6 None %98 -%94 = OpFunctionParameter %8 -%95 = OpFunctionParameter %5 -%96 = OpFunctionParameter %5 -%93 = OpLabel -%99 = OpLoad %9 %25 -OpBranch %100 -%100 = OpLabel -%101 = OpCompositeConstruct %12 %94 %95 -%102 = OpImageQueryLevels %5 %99 -%103 = OpISub %5 %102 %53 -%104 = OpExtInst %5 %1 UMin %96 %103 -%105 = OpImageQuerySizeLod %12 %99 %104 -%107 = OpISub %12 %105 %106 -%108 = OpExtInst %12 %1 UMin %101 %107 -%109 = OpImageFetch %6 %99 %108 Lod %104 -OpReturnValue %109 +%98 = OpFunction %7 None %99 +%95 = OpFunctionParameter %9 +%96 = OpFunctionParameter %6 +%97 = OpFunctionParameter %6 +%94 = OpLabel +%100 = OpLoad %10 %26 +OpBranch %101 +%101 = OpLabel +OpLine %3 23 11 +%102 = OpCompositeConstruct %13 %95 %96 +%103 = OpImageQueryLevels %6 %100 +%104 = OpISub %6 %103 %54 +%105 = OpExtInst %6 %1 UMin %97 %104 +%106 = OpImageQuerySizeLod %13 %100 %105 +%108 = OpISub %13 %106 %107 +%109 = OpExtInst %13 %1 UMin %102 %108 +%110 = OpImageFetch %7 %100 %109 Lod %105 +OpReturnValue %110 OpFunctionEnd -%113 = OpFunction %6 None %114 -%111 = OpFunctionParameter %12 -%112 = OpFunctionParameter %5 -%110 = OpLabel -%115 = OpLoad %11 %27 -OpBranch %116 -%116 = OpLabel -%117 = OpImageQueryLevels %5 %115 -%118 = OpISub %5 %117 %53 -%119 = OpExtInst %5 %1 UMin %112 %118 -%120 = OpImageQuerySizeLod %12 %115 %119 -%122 = OpISub %12 %120 %121 -%123 = OpExtInst %12 %1 UMin %111 %122 -%124 = OpImageFetch %6 %115 %123 Lod %119 -OpReturnValue %124 +%114 = OpFunction %7 None %115 +%112 = OpFunctionParameter %13 +%113 = OpFunctionParameter %6 +%111 = OpLabel +%116 = OpLoad %12 %28 +OpBranch %117 +%117 = OpLabel +OpLine %3 30 11 +%118 = OpImageQueryLevels %6 %116 +%119 = OpISub %6 %118 %54 +%120 = OpExtInst %6 %1 UMin %113 %119 +%121 = OpImageQuerySizeLod %13 %116 %120 +%123 = OpISub %13 %121 %122 +%124 = OpExtInst %13 %1 UMin %112 %123 +%125 = OpImageFetch %7 %116 %124 Lod %120 +OpReturnValue %125 OpFunctionEnd -%128 = OpFunction %6 None %64 -%126 = OpFunctionParameter %8 -%127 = OpFunctionParameter %5 -%125 = OpLabel -%129 = OpLoad %13 %29 -OpBranch %130 -%130 = OpLabel -%131 = OpImageQuerySamples %5 %129 -%132 = OpISub %5 %131 %53 -%133 = OpExtInst %5 %1 UMin %127 %132 -%134 = OpImageQuerySize %8 %129 -%136 = OpISub %8 %134 %135 -%137 = OpExtInst %8 %1 UMin %126 %136 -%138 = OpImageFetch %6 %129 %137 Sample %133 -OpReturnValue %138 +%129 = OpFunction %7 None %65 +%127 = OpFunctionParameter %9 +%128 = OpFunctionParameter %6 +%126 = OpLabel +%130 = OpLoad %14 %30 +OpBranch %131 +%131 = OpLabel +OpLine %3 37 11 +%132 = OpImageQuerySamples %6 %130 +%133 = OpISub %6 %132 %54 +%134 = OpExtInst %6 %1 UMin %128 %133 +%135 = OpImageQuerySize %9 %130 +%137 = OpISub %9 %135 %136 +%138 = OpExtInst %9 %1 UMin %127 %137 +%139 = OpImageFetch %7 %130 %138 Sample %134 +OpReturnValue %139 OpFunctionEnd -%142 = OpFunction %4 None %143 -%140 = OpFunctionParameter %8 -%141 = OpFunctionParameter %5 -%139 = OpLabel -%144 = OpLoad %14 %31 -OpBranch %145 -%145 = OpLabel -%146 = OpImageQueryLevels %5 %144 -%147 = OpISub %5 %146 %53 -%148 = OpExtInst %5 %1 UMin %141 %147 -%149 = OpImageQuerySizeLod %8 %144 %148 -%151 = OpISub %8 %149 %150 -%152 = OpExtInst %8 %1 UMin %140 %151 -%153 = OpImageFetch %6 %144 %152 Lod %148 -%154 = OpCompositeExtract %4 %153 0 -OpReturnValue %154 +%143 = OpFunction %5 None %144 +%141 = OpFunctionParameter %9 +%142 = OpFunctionParameter %6 +%140 = OpLabel +%145 = OpLoad %15 %32 +OpBranch %146 +%146 = OpLabel +OpLine %3 44 11 +%147 = OpImageQueryLevels %6 %145 +%148 = OpISub %6 %147 %54 +%149 = OpExtInst %6 %1 UMin %142 %148 +%150 = OpImageQuerySizeLod %9 %145 %149 +%152 = OpISub %9 %150 %151 +%153 = OpExtInst %9 %1 UMin %141 %152 +%154 = OpImageFetch %7 %145 %153 Lod %149 +%155 = OpCompositeExtract %5 %154 0 +OpReturnValue %155 OpFunctionEnd -%159 = OpFunction %4 None %160 -%156 = OpFunctionParameter %8 -%157 = OpFunctionParameter %10 -%158 = OpFunctionParameter %5 -%155 = OpLabel -%161 = OpLoad %15 %33 -OpBranch %162 -%162 = OpLabel -%163 = OpBitcast %5 %157 -%164 = OpCompositeConstruct %12 %156 %163 -%165 = OpImageQueryLevels %5 %161 -%166 = OpISub %5 %165 %53 -%167 = OpExtInst %5 %1 UMin %158 %166 -%168 = OpImageQuerySizeLod %12 %161 %167 -%170 = OpISub %12 %168 %169 -%171 = OpExtInst %12 %1 UMin %164 %170 -%172 = OpImageFetch %6 %161 %171 Lod %167 -%173 = OpCompositeExtract %4 %172 0 -OpReturnValue %173 +%160 = OpFunction %5 None %161 +%157 = OpFunctionParameter %9 +%158 = OpFunctionParameter %11 +%159 = OpFunctionParameter %6 +%156 = OpLabel +%162 = OpLoad %16 %34 +OpBranch %163 +%163 = OpLabel +OpLine %3 51 11 +%164 = OpBitcast %6 %158 +%165 = OpCompositeConstruct %13 %157 %164 +%166 = OpImageQueryLevels %6 %162 +%167 = OpISub %6 %166 %54 +%168 = OpExtInst %6 %1 UMin %159 %167 +%169 = OpImageQuerySizeLod %13 %162 %168 +%171 = OpISub %13 %169 %170 +%172 = OpExtInst %13 %1 UMin %165 %171 +%173 = OpImageFetch %7 %162 %172 Lod %168 +%174 = OpCompositeExtract %5 %173 0 +OpReturnValue %174 OpFunctionEnd -%178 = OpFunction %4 None %179 -%175 = OpFunctionParameter %8 -%176 = OpFunctionParameter %5 -%177 = OpFunctionParameter %5 -%174 = OpLabel -%180 = OpLoad %15 %33 -OpBranch %181 -%181 = OpLabel -%182 = OpCompositeConstruct %12 %175 %176 -%183 = OpImageQueryLevels %5 %180 -%184 = OpISub %5 %183 %53 -%185 = OpExtInst %5 %1 UMin %177 %184 -%186 = OpImageQuerySizeLod %12 %180 %185 -%188 = OpISub %12 %186 %187 -%189 = OpExtInst %12 %1 UMin %182 %188 -%190 = OpImageFetch %6 %180 %189 Lod %185 -%191 = OpCompositeExtract %4 %190 0 -OpReturnValue %191 +%179 = OpFunction %5 None %180 +%176 = OpFunctionParameter %9 +%177 = OpFunctionParameter %6 +%178 = OpFunctionParameter %6 +%175 = OpLabel +%181 = OpLoad %16 %34 +OpBranch %182 +%182 = OpLabel +OpLine %3 55 11 +%183 = OpCompositeConstruct %13 %176 %177 +%184 = OpImageQueryLevels %6 %181 +%185 = OpISub %6 %184 %54 +%186 = OpExtInst %6 %1 UMin %178 %185 +%187 = OpImageQuerySizeLod %13 %181 %186 +%189 = OpISub %13 %187 %188 +%190 = OpExtInst %13 %1 UMin %183 %189 +%191 = OpImageFetch %7 %181 %190 Lod %186 +%192 = OpCompositeExtract %5 %191 0 +OpReturnValue %192 OpFunctionEnd -%195 = OpFunction %4 None %143 -%193 = OpFunctionParameter %8 -%194 = OpFunctionParameter %5 -%192 = OpLabel -%196 = OpLoad %16 %35 -OpBranch %197 -%197 = OpLabel -%198 = OpImageQuerySamples %5 %196 -%199 = OpISub %5 %198 %53 -%200 = OpExtInst %5 %1 UMin %194 %199 -%201 = OpImageQuerySize %8 %196 -%203 = OpISub %8 %201 %202 -%204 = OpExtInst %8 %1 UMin %193 %203 -%205 = OpImageFetch %6 %196 %204 Sample %200 -%206 = OpCompositeExtract %4 %205 0 -OpReturnValue %206 +%196 = OpFunction %5 None %144 +%194 = OpFunctionParameter %9 +%195 = OpFunctionParameter %6 +%193 = OpLabel +%197 = OpLoad %17 %36 +OpBranch %198 +%198 = OpLabel +OpLine %3 62 11 +%199 = OpImageQuerySamples %6 %197 +%200 = OpISub %6 %199 %54 +%201 = OpExtInst %6 %1 UMin %195 %200 +%202 = OpImageQuerySize %9 %197 +%204 = OpISub %9 %202 %203 +%205 = OpExtInst %9 %1 UMin %194 %204 +%206 = OpImageFetch %7 %197 %205 Sample %201 +%207 = OpCompositeExtract %5 %206 0 +OpReturnValue %207 OpFunctionEnd -%210 = OpFunction %2 None %211 -%208 = OpFunctionParameter %5 +%211 = OpFunction %2 None %212 %209 = OpFunctionParameter %6 -%207 = OpLabel -%212 = OpLoad %17 %37 -OpBranch %213 -%213 = OpLabel -OpImageWrite %212 %208 %209 -OpReturn -OpFunctionEnd -%217 = OpFunction %2 None %218 -%215 = OpFunctionParameter %8 -%216 = OpFunctionParameter %6 +%210 = OpFunctionParameter %7 +%208 = OpLabel +%213 = OpLoad %18 %38 +OpBranch %214 %214 = OpLabel -%219 = OpLoad %18 %39 -OpBranch %220 -%220 = OpLabel -OpImageWrite %219 %215 %216 +OpLine %3 69 5 +OpImageWrite %213 %209 %210 OpReturn OpFunctionEnd -%225 = OpFunction %2 None %226 -%222 = OpFunctionParameter %8 -%223 = OpFunctionParameter %10 -%224 = OpFunctionParameter %6 +%218 = OpFunction %2 None %219 +%216 = OpFunctionParameter %9 +%217 = OpFunctionParameter %7 +%215 = OpLabel +%220 = OpLoad %19 %40 +OpBranch %221 %221 = OpLabel -%227 = OpLoad %19 %41 -OpBranch %228 -%228 = OpLabel -%229 = OpBitcast %5 %223 -%230 = OpCompositeConstruct %12 %222 %229 -OpImageWrite %227 %230 %224 +OpLine %3 76 5 +OpImageWrite %220 %216 %217 OpReturn OpFunctionEnd -%235 = OpFunction %2 None %236 -%232 = OpFunctionParameter %8 -%233 = OpFunctionParameter %5 +%226 = OpFunction %2 None %227 +%223 = OpFunctionParameter %9 +%224 = OpFunctionParameter %11 +%225 = OpFunctionParameter %7 +%222 = OpLabel +%228 = OpLoad %20 %42 +OpBranch %229 +%229 = OpLabel +OpLine %3 83 2 +%230 = OpBitcast %6 %224 +%231 = OpCompositeConstruct %13 %223 %230 +OpImageWrite %228 %231 %225 +OpReturn +OpFunctionEnd +%236 = OpFunction %2 None %237 +%233 = OpFunctionParameter %9 %234 = OpFunctionParameter %6 -%231 = OpLabel -%237 = OpLoad %19 %41 -OpBranch %238 -%238 = OpLabel -%239 = OpCompositeConstruct %12 %232 %233 -OpImageWrite %237 %239 %234 +%235 = OpFunctionParameter %7 +%232 = OpLabel +%238 = OpLoad %20 %42 +OpBranch %239 +%239 = OpLabel +OpLine %3 87 2 +%240 = OpCompositeConstruct %13 %233 %234 +OpImageWrite %238 %240 %235 OpReturn OpFunctionEnd -%243 = OpFunction %2 None %244 -%241 = OpFunctionParameter %12 -%242 = OpFunctionParameter %6 -%240 = OpLabel -%245 = OpLoad %20 %43 -OpBranch %246 -%246 = OpLabel -OpImageWrite %245 %241 %242 -OpReturn -OpFunctionEnd -%250 = OpFunction %2 None %251 +%244 = OpFunction %2 None %245 +%242 = OpFunctionParameter %13 +%243 = OpFunctionParameter %7 +%241 = OpLabel +%246 = OpLoad %21 %44 +OpBranch %247 %247 = OpLabel -%252 = OpLoad %3 %21 -%253 = OpLoad %7 %23 -%254 = OpLoad %9 %25 -%255 = OpLoad %11 %27 -%256 = OpLoad %13 %29 -%257 = OpLoad %17 %37 -%258 = OpLoad %18 %39 -%259 = OpLoad %19 %41 -%260 = OpLoad %20 %43 -OpBranch %268 -%268 = OpLabel -%269 = OpFunctionCall %6 %48 %261 %261 -%270 = OpFunctionCall %6 %63 %262 %261 -%271 = OpFunctionCall %6 %79 %262 %263 %261 -%272 = OpFunctionCall %6 %97 %262 %261 %261 -%273 = OpFunctionCall %6 %113 %264 %261 -%274 = OpFunctionCall %6 %128 %262 %261 -%275 = OpFunctionCall %2 %210 %261 %265 -%276 = OpFunctionCall %2 %217 %262 %265 -%277 = OpFunctionCall %2 %225 %262 %263 %265 -%278 = OpFunctionCall %2 %235 %262 %261 %265 -%279 = OpFunctionCall %2 %243 %264 %265 -OpStore %248 %267 +OpLine %3 94 5 +OpImageWrite %246 %242 %243 +OpReturn +OpFunctionEnd +%251 = OpFunction %2 None %252 +%248 = OpLabel +%253 = OpLoad %4 %22 +%254 = OpLoad %8 %24 +%255 = OpLoad %10 %26 +%256 = OpLoad %12 %28 +%257 = OpLoad %14 %30 +%258 = OpLoad %18 %38 +%259 = OpLoad %19 %40 +%260 = OpLoad %20 %42 +%261 = OpLoad %21 %44 +OpBranch %269 +%269 = OpLabel +OpLine %3 101 5 +%270 = OpFunctionCall %7 %49 %262 %262 +OpLine %3 102 5 +%271 = OpFunctionCall %7 %64 %263 %262 +OpLine %3 103 5 +%272 = OpFunctionCall %7 %80 %263 %264 %262 +OpLine %3 104 5 +%273 = OpFunctionCall %7 %98 %263 %262 %262 +OpLine %3 105 5 +%274 = OpFunctionCall %7 %114 %265 %262 +OpLine %3 106 5 +%275 = OpFunctionCall %7 %129 %263 %262 +OpLine %3 112 5 +%276 = OpFunctionCall %2 %211 %262 %266 +OpLine %3 113 5 +%277 = OpFunctionCall %2 %218 %263 %266 +OpLine %3 114 5 +%278 = OpFunctionCall %2 %226 %263 %264 %266 +OpLine %3 115 5 +%279 = OpFunctionCall %2 %236 %263 %262 %266 +OpLine %3 116 5 +%280 = OpFunctionCall %2 %244 %265 %266 +OpLine %3 118 12 +OpStore %249 %268 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/bounds-check-image-rzsw.spvasm b/naga/tests/out/spv/bounds-check-image-rzsw.spvasm index 9b8c091bba..d63c4e85a4 100644 --- a/naga/tests/out/spv/bounds-check-image-rzsw.spvasm +++ b/naga/tests/out/spv/bounds-check-image-rzsw.spvasm @@ -1,499 +1,647 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 302 +; Bound: 303 OpCapability Shader OpCapability Sampled1D OpCapability Image1D OpCapability ImageQuery %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %273 "fragment_shader" %271 -OpExecutionMode %273 OriginUpperLeft -OpName %21 "image_1d" -OpName %23 "image_2d" -OpName %25 "image_2d_array" -OpName %27 "image_3d" -OpName %29 "image_multisampled_2d" -OpName %31 "image_depth_2d" -OpName %33 "image_depth_2d_array" -OpName %35 "image_depth_multisampled_2d" -OpName %37 "image_storage_1d" -OpName %39 "image_storage_2d" -OpName %41 "image_storage_2d_array" -OpName %43 "image_storage_3d" -OpName %46 "coords" -OpName %47 "level" -OpName %48 "test_textureLoad_1d" -OpName %64 "coords" -OpName %65 "level" -OpName %66 "test_textureLoad_2d" -OpName %82 "coords" -OpName %83 "index" -OpName %84 "level" -OpName %85 "test_textureLoad_2d_array_u" -OpName %103 "coords" -OpName %104 "index" -OpName %105 "level" -OpName %106 "test_textureLoad_2d_array_s" -OpName %122 "coords" -OpName %123 "level" -OpName %124 "test_textureLoad_3d" -OpName %139 "coords" -OpName %140 "_sample" -OpName %141 "test_textureLoad_multisampled_2d" -OpName %155 "coords" -OpName %156 "level" -OpName %157 "test_textureLoad_depth_2d" -OpName %173 "coords" -OpName %174 "index" -OpName %175 "level" -OpName %176 "test_textureLoad_depth_2d_array_u" -OpName %194 "coords" -OpName %195 "index" -OpName %196 "level" -OpName %197 "test_textureLoad_depth_2d_array_s" -OpName %214 "coords" -OpName %215 "_sample" -OpName %216 "test_textureLoad_depth_multisampled_2d" -OpName %231 "coords" -OpName %232 "value" -OpName %233 "test_textureStore_1d" -OpName %238 "coords" -OpName %239 "value" -OpName %240 "test_textureStore_2d" -OpName %245 "coords" -OpName %246 "array_index" -OpName %247 "value" -OpName %248 "test_textureStore_2d_array_u" -OpName %255 "coords" -OpName %256 "array_index" -OpName %257 "value" -OpName %258 "test_textureStore_2d_array_s" -OpName %264 "coords" -OpName %265 "value" -OpName %266 "test_textureStore_3d" -OpName %273 "fragment_shader" -OpDecorate %21 DescriptorSet 0 -OpDecorate %21 Binding 0 -OpDecorate %23 DescriptorSet 0 -OpDecorate %23 Binding 1 -OpDecorate %25 DescriptorSet 0 -OpDecorate %25 Binding 2 -OpDecorate %27 DescriptorSet 0 -OpDecorate %27 Binding 3 -OpDecorate %29 DescriptorSet 0 -OpDecorate %29 Binding 4 -OpDecorate %31 DescriptorSet 0 -OpDecorate %31 Binding 5 -OpDecorate %33 DescriptorSet 0 -OpDecorate %33 Binding 6 -OpDecorate %35 DescriptorSet 0 -OpDecorate %35 Binding 7 -OpDecorate %37 NonReadable -OpDecorate %37 DescriptorSet 0 -OpDecorate %37 Binding 8 -OpDecorate %39 NonReadable -OpDecorate %39 DescriptorSet 0 -OpDecorate %39 Binding 9 -OpDecorate %41 NonReadable -OpDecorate %41 DescriptorSet 0 -OpDecorate %41 Binding 10 -OpDecorate %43 NonReadable -OpDecorate %43 DescriptorSet 0 -OpDecorate %43 Binding 11 -OpDecorate %271 Location 0 +OpEntryPoint Fragment %274 "fragment_shader" %272 +OpExecutionMode %274 OriginUpperLeft +%3 = OpString "bounds-check-image-rzsw.wgsl" +OpSource Unknown 0 %3 "@group(0) @binding(0) +var image_1d: texture_1d; + +fn test_textureLoad_1d(coords: i32, level: i32) -> vec4 { + return textureLoad(image_1d, coords, level); +} + +@group(0) @binding(1) +var image_2d: texture_2d; + +fn test_textureLoad_2d(coords: vec2, level: i32) -> vec4 { + return textureLoad(image_2d, coords, level); +} + +@group(0) @binding(2) +var image_2d_array: texture_2d_array; + +fn test_textureLoad_2d_array_u(coords: vec2, index: u32, level: i32) -> vec4 { + return textureLoad(image_2d_array, coords, index, level); +} + +fn test_textureLoad_2d_array_s(coords: vec2, index: i32, level: i32) -> vec4 { + return textureLoad(image_2d_array, coords, index, level); +} + +@group(0) @binding(3) +var image_3d: texture_3d; + +fn test_textureLoad_3d(coords: vec3, level: i32) -> vec4 { + return textureLoad(image_3d, coords, level); +} + +@group(0) @binding(4) +var image_multisampled_2d: texture_multisampled_2d; + +fn test_textureLoad_multisampled_2d(coords: vec2, _sample: i32) -> vec4 { + return textureLoad(image_multisampled_2d, coords, _sample); +} + +@group(0) @binding(5) +var image_depth_2d: texture_depth_2d; + +fn test_textureLoad_depth_2d(coords: vec2, level: i32) -> f32 { + return textureLoad(image_depth_2d, coords, level); +} + +@group(0) @binding(6) +var image_depth_2d_array: texture_depth_2d_array; + +fn test_textureLoad_depth_2d_array_u(coords: vec2, index: u32, level: i32) -> f32 { + return textureLoad(image_depth_2d_array, coords, index, level); +} + +fn test_textureLoad_depth_2d_array_s(coords: vec2, index: i32, level: i32) -> f32 { + return textureLoad(image_depth_2d_array, coords, index, level); +} + +@group(0) @binding(7) +var image_depth_multisampled_2d: texture_depth_multisampled_2d; + +fn test_textureLoad_depth_multisampled_2d(coords: vec2, _sample: i32) -> f32 { + return textureLoad(image_depth_multisampled_2d, coords, _sample); +} + +@group(0) @binding(8) +var image_storage_1d: texture_storage_1d; + +fn test_textureStore_1d(coords: i32, value: vec4) { + textureStore(image_storage_1d, coords, value); +} + +@group(0) @binding(9) +var image_storage_2d: texture_storage_2d; + +fn test_textureStore_2d(coords: vec2, value: vec4) { + textureStore(image_storage_2d, coords, value); +} + +@group(0) @binding(10) +var image_storage_2d_array: texture_storage_2d_array; + +fn test_textureStore_2d_array_u(coords: vec2, array_index: u32, value: vec4) { + textureStore(image_storage_2d_array, coords, array_index, value); +} + +fn test_textureStore_2d_array_s(coords: vec2, array_index: i32, value: vec4) { + textureStore(image_storage_2d_array, coords, array_index, value); +} + +@group(0) @binding(11) +var image_storage_3d: texture_storage_3d; + +fn test_textureStore_3d(coords: vec3, value: vec4) { + textureStore(image_storage_3d, coords, value); +} + +// GLSL output requires that we identify an entry point, so +// that it can tell what \"in\" and \"out\" globals to write. +@fragment +fn fragment_shader() -> @location(0) vec4 { + test_textureLoad_1d(0, 0); + test_textureLoad_2d(vec2(), 0); + test_textureLoad_2d_array_u(vec2(), 0u, 0); + test_textureLoad_2d_array_s(vec2(), 0, 0); + test_textureLoad_3d(vec3(), 0); + test_textureLoad_multisampled_2d(vec2(), 0); + // Not yet implemented for GLSL: + // test_textureLoad_depth_2d(vec2(), 0); + // test_textureLoad_depth_2d_array_u(vec2(), 0u, 0); + // test_textureLoad_depth_2d_array_s(vec2(), 0, 0); + // test_textureLoad_depth_multisampled_2d(vec2(), 0); + test_textureStore_1d(0, vec4()); + test_textureStore_2d(vec2(), vec4()); + test_textureStore_2d_array_u(vec2(), 0u, vec4()); + test_textureStore_2d_array_s(vec2(), 0, vec4()); + test_textureStore_3d(vec3(), vec4()); + + return vec4(0.,0.,0.,0.); +} +" +OpName %22 "image_1d" +OpName %24 "image_2d" +OpName %26 "image_2d_array" +OpName %28 "image_3d" +OpName %30 "image_multisampled_2d" +OpName %32 "image_depth_2d" +OpName %34 "image_depth_2d_array" +OpName %36 "image_depth_multisampled_2d" +OpName %38 "image_storage_1d" +OpName %40 "image_storage_2d" +OpName %42 "image_storage_2d_array" +OpName %44 "image_storage_3d" +OpName %47 "coords" +OpName %48 "level" +OpName %49 "test_textureLoad_1d" +OpName %65 "coords" +OpName %66 "level" +OpName %67 "test_textureLoad_2d" +OpName %83 "coords" +OpName %84 "index" +OpName %85 "level" +OpName %86 "test_textureLoad_2d_array_u" +OpName %104 "coords" +OpName %105 "index" +OpName %106 "level" +OpName %107 "test_textureLoad_2d_array_s" +OpName %123 "coords" +OpName %124 "level" +OpName %125 "test_textureLoad_3d" +OpName %140 "coords" +OpName %141 "_sample" +OpName %142 "test_textureLoad_multisampled_2d" +OpName %156 "coords" +OpName %157 "level" +OpName %158 "test_textureLoad_depth_2d" +OpName %174 "coords" +OpName %175 "index" +OpName %176 "level" +OpName %177 "test_textureLoad_depth_2d_array_u" +OpName %195 "coords" +OpName %196 "index" +OpName %197 "level" +OpName %198 "test_textureLoad_depth_2d_array_s" +OpName %215 "coords" +OpName %216 "_sample" +OpName %217 "test_textureLoad_depth_multisampled_2d" +OpName %232 "coords" +OpName %233 "value" +OpName %234 "test_textureStore_1d" +OpName %239 "coords" +OpName %240 "value" +OpName %241 "test_textureStore_2d" +OpName %246 "coords" +OpName %247 "array_index" +OpName %248 "value" +OpName %249 "test_textureStore_2d_array_u" +OpName %256 "coords" +OpName %257 "array_index" +OpName %258 "value" +OpName %259 "test_textureStore_2d_array_s" +OpName %265 "coords" +OpName %266 "value" +OpName %267 "test_textureStore_3d" +OpName %274 "fragment_shader" +OpDecorate %22 DescriptorSet 0 +OpDecorate %22 Binding 0 +OpDecorate %24 DescriptorSet 0 +OpDecorate %24 Binding 1 +OpDecorate %26 DescriptorSet 0 +OpDecorate %26 Binding 2 +OpDecorate %28 DescriptorSet 0 +OpDecorate %28 Binding 3 +OpDecorate %30 DescriptorSet 0 +OpDecorate %30 Binding 4 +OpDecorate %32 DescriptorSet 0 +OpDecorate %32 Binding 5 +OpDecorate %34 DescriptorSet 0 +OpDecorate %34 Binding 6 +OpDecorate %36 DescriptorSet 0 +OpDecorate %36 Binding 7 +OpDecorate %38 NonReadable +OpDecorate %38 DescriptorSet 0 +OpDecorate %38 Binding 8 +OpDecorate %40 NonReadable +OpDecorate %40 DescriptorSet 0 +OpDecorate %40 Binding 9 +OpDecorate %42 NonReadable +OpDecorate %42 DescriptorSet 0 +OpDecorate %42 Binding 10 +OpDecorate %44 NonReadable +OpDecorate %44 DescriptorSet 0 +OpDecorate %44 Binding 11 +OpDecorate %272 Location 0 %2 = OpTypeVoid -%4 = OpTypeFloat 32 -%3 = OpTypeImage %4 1D 0 0 0 1 Unknown -%5 = OpTypeInt 32 1 -%6 = OpTypeVector %4 4 -%7 = OpTypeImage %4 2D 0 0 0 1 Unknown -%8 = OpTypeVector %5 2 -%9 = OpTypeImage %4 2D 0 1 0 1 Unknown -%10 = OpTypeInt 32 0 -%11 = OpTypeImage %4 3D 0 0 0 1 Unknown -%12 = OpTypeVector %5 3 -%13 = OpTypeImage %4 2D 0 0 1 1 Unknown -%14 = OpTypeImage %4 2D 1 0 0 1 Unknown -%15 = OpTypeImage %4 2D 1 1 0 1 Unknown -%16 = OpTypeImage %4 2D 1 0 1 1 Unknown -%17 = OpTypeImage %4 1D 0 0 0 2 Rgba8 -%18 = OpTypeImage %4 2D 0 0 0 2 Rgba8 -%19 = OpTypeImage %4 2D 0 1 0 2 Rgba8 -%20 = OpTypeImage %4 3D 0 0 0 2 Rgba8 -%22 = OpTypePointer UniformConstant %3 -%21 = OpVariable %22 UniformConstant -%24 = OpTypePointer UniformConstant %7 -%23 = OpVariable %24 UniformConstant -%26 = OpTypePointer UniformConstant %9 -%25 = OpVariable %26 UniformConstant -%28 = OpTypePointer UniformConstant %11 -%27 = OpVariable %28 UniformConstant -%30 = OpTypePointer UniformConstant %13 -%29 = OpVariable %30 UniformConstant -%32 = OpTypePointer UniformConstant %14 -%31 = OpVariable %32 UniformConstant -%34 = OpTypePointer UniformConstant %15 -%33 = OpVariable %34 UniformConstant -%36 = OpTypePointer UniformConstant %16 -%35 = OpVariable %36 UniformConstant -%38 = OpTypePointer UniformConstant %17 -%37 = OpVariable %38 UniformConstant -%40 = OpTypePointer UniformConstant %18 -%39 = OpVariable %40 UniformConstant -%42 = OpTypePointer UniformConstant %19 -%41 = OpVariable %42 UniformConstant -%44 = OpTypePointer UniformConstant %20 -%43 = OpVariable %44 UniformConstant -%49 = OpTypeFunction %6 %5 %5 -%52 = OpTypeBool -%53 = OpConstantNull %6 -%67 = OpTypeFunction %6 %8 %5 -%75 = OpTypeVector %52 2 -%86 = OpTypeFunction %6 %8 %10 %5 -%96 = OpTypeVector %52 3 -%107 = OpTypeFunction %6 %8 %5 %5 -%125 = OpTypeFunction %6 %12 %5 -%158 = OpTypeFunction %4 %8 %5 -%177 = OpTypeFunction %4 %8 %10 %5 -%198 = OpTypeFunction %4 %8 %5 %5 -%234 = OpTypeFunction %2 %5 %6 -%241 = OpTypeFunction %2 %8 %6 -%249 = OpTypeFunction %2 %8 %10 %6 -%259 = OpTypeFunction %2 %8 %5 %6 -%267 = OpTypeFunction %2 %12 %6 -%272 = OpTypePointer Output %6 -%271 = OpVariable %272 Output -%274 = OpTypeFunction %2 -%284 = OpConstant %5 0 -%285 = OpConstantNull %8 -%286 = OpConstant %10 0 -%287 = OpConstantNull %12 -%288 = OpConstant %4 0.0 -%289 = OpConstantComposite %6 %288 %288 %288 %288 -%48 = OpFunction %6 None %49 -%46 = OpFunctionParameter %5 -%47 = OpFunctionParameter %5 -%45 = OpLabel -%50 = OpLoad %3 %21 -OpBranch %51 -%51 = OpLabel -%54 = OpImageQueryLevels %5 %50 -%55 = OpULessThan %52 %47 %54 -OpSelectionMerge %56 None -OpBranchConditional %55 %57 %56 +%5 = OpTypeFloat 32 +%4 = OpTypeImage %5 1D 0 0 0 1 Unknown +%6 = OpTypeInt 32 1 +%7 = OpTypeVector %5 4 +%8 = OpTypeImage %5 2D 0 0 0 1 Unknown +%9 = OpTypeVector %6 2 +%10 = OpTypeImage %5 2D 0 1 0 1 Unknown +%11 = OpTypeInt 32 0 +%12 = OpTypeImage %5 3D 0 0 0 1 Unknown +%13 = OpTypeVector %6 3 +%14 = OpTypeImage %5 2D 0 0 1 1 Unknown +%15 = OpTypeImage %5 2D 1 0 0 1 Unknown +%16 = OpTypeImage %5 2D 1 1 0 1 Unknown +%17 = OpTypeImage %5 2D 1 0 1 1 Unknown +%18 = OpTypeImage %5 1D 0 0 0 2 Rgba8 +%19 = OpTypeImage %5 2D 0 0 0 2 Rgba8 +%20 = OpTypeImage %5 2D 0 1 0 2 Rgba8 +%21 = OpTypeImage %5 3D 0 0 0 2 Rgba8 +%23 = OpTypePointer UniformConstant %4 +%22 = OpVariable %23 UniformConstant +%25 = OpTypePointer UniformConstant %8 +%24 = OpVariable %25 UniformConstant +%27 = OpTypePointer UniformConstant %10 +%26 = OpVariable %27 UniformConstant +%29 = OpTypePointer UniformConstant %12 +%28 = OpVariable %29 UniformConstant +%31 = OpTypePointer UniformConstant %14 +%30 = OpVariable %31 UniformConstant +%33 = OpTypePointer UniformConstant %15 +%32 = OpVariable %33 UniformConstant +%35 = OpTypePointer UniformConstant %16 +%34 = OpVariable %35 UniformConstant +%37 = OpTypePointer UniformConstant %17 +%36 = OpVariable %37 UniformConstant +%39 = OpTypePointer UniformConstant %18 +%38 = OpVariable %39 UniformConstant +%41 = OpTypePointer UniformConstant %19 +%40 = OpVariable %41 UniformConstant +%43 = OpTypePointer UniformConstant %20 +%42 = OpVariable %43 UniformConstant +%45 = OpTypePointer UniformConstant %21 +%44 = OpVariable %45 UniformConstant +%50 = OpTypeFunction %7 %6 %6 +%53 = OpTypeBool +%54 = OpConstantNull %7 +%68 = OpTypeFunction %7 %9 %6 +%76 = OpTypeVector %53 2 +%87 = OpTypeFunction %7 %9 %11 %6 +%97 = OpTypeVector %53 3 +%108 = OpTypeFunction %7 %9 %6 %6 +%126 = OpTypeFunction %7 %13 %6 +%159 = OpTypeFunction %5 %9 %6 +%178 = OpTypeFunction %5 %9 %11 %6 +%199 = OpTypeFunction %5 %9 %6 %6 +%235 = OpTypeFunction %2 %6 %7 +%242 = OpTypeFunction %2 %9 %7 +%250 = OpTypeFunction %2 %9 %11 %7 +%260 = OpTypeFunction %2 %9 %6 %7 +%268 = OpTypeFunction %2 %13 %7 +%273 = OpTypePointer Output %7 +%272 = OpVariable %273 Output +%275 = OpTypeFunction %2 +%285 = OpConstant %6 0 +%286 = OpConstantNull %9 +%287 = OpConstant %11 0 +%288 = OpConstantNull %13 +%289 = OpConstant %5 0.0 +%290 = OpConstantComposite %7 %289 %289 %289 %289 +%49 = OpFunction %7 None %50 +%47 = OpFunctionParameter %6 +%48 = OpFunctionParameter %6 +%46 = OpLabel +%51 = OpLoad %4 %22 +OpBranch %52 +%52 = OpLabel +OpLine %3 5 11 +%55 = OpImageQueryLevels %6 %51 +%56 = OpULessThan %53 %48 %55 +OpSelectionMerge %57 None +OpBranchConditional %56 %58 %57 +%58 = OpLabel +%59 = OpImageQuerySizeLod %6 %51 %48 +%60 = OpULessThan %53 %47 %59 +OpBranchConditional %60 %61 %57 +%61 = OpLabel +%62 = OpImageFetch %7 %51 %47 Lod %48 +OpBranch %57 %57 = OpLabel -%58 = OpImageQuerySizeLod %5 %50 %47 -%59 = OpULessThan %52 %46 %58 -OpBranchConditional %59 %60 %56 -%60 = OpLabel -%61 = OpImageFetch %6 %50 %46 Lod %47 -OpBranch %56 -%56 = OpLabel -%62 = OpPhi %6 %53 %51 %53 %57 %61 %60 -OpReturnValue %62 +%63 = OpPhi %7 %54 %52 %54 %58 %62 %61 +OpReturnValue %63 OpFunctionEnd -%66 = OpFunction %6 None %67 -%64 = OpFunctionParameter %8 -%65 = OpFunctionParameter %5 -%63 = OpLabel -%68 = OpLoad %7 %23 -OpBranch %69 -%69 = OpLabel -%70 = OpImageQueryLevels %5 %68 -%71 = OpULessThan %52 %65 %70 -OpSelectionMerge %72 None -OpBranchConditional %71 %73 %72 +%67 = OpFunction %7 None %68 +%65 = OpFunctionParameter %9 +%66 = OpFunctionParameter %6 +%64 = OpLabel +%69 = OpLoad %8 %24 +OpBranch %70 +%70 = OpLabel +OpLine %3 12 11 +%71 = OpImageQueryLevels %6 %69 +%72 = OpULessThan %53 %66 %71 +OpSelectionMerge %73 None +OpBranchConditional %72 %74 %73 +%74 = OpLabel +%75 = OpImageQuerySizeLod %9 %69 %66 +%77 = OpULessThan %76 %65 %75 +%78 = OpAll %53 %77 +OpBranchConditional %78 %79 %73 +%79 = OpLabel +%80 = OpImageFetch %7 %69 %65 Lod %66 +OpBranch %73 %73 = OpLabel -%74 = OpImageQuerySizeLod %8 %68 %65 -%76 = OpULessThan %75 %64 %74 -%77 = OpAll %52 %76 -OpBranchConditional %77 %78 %72 -%78 = OpLabel -%79 = OpImageFetch %6 %68 %64 Lod %65 -OpBranch %72 -%72 = OpLabel -%80 = OpPhi %6 %53 %69 %53 %73 %79 %78 -OpReturnValue %80 +%81 = OpPhi %7 %54 %70 %54 %74 %80 %79 +OpReturnValue %81 OpFunctionEnd -%85 = OpFunction %6 None %86 -%82 = OpFunctionParameter %8 -%83 = OpFunctionParameter %10 -%84 = OpFunctionParameter %5 -%81 = OpLabel -%87 = OpLoad %9 %25 -OpBranch %88 -%88 = OpLabel -%89 = OpBitcast %5 %83 -%90 = OpCompositeConstruct %12 %82 %89 -%91 = OpImageQueryLevels %5 %87 -%92 = OpULessThan %52 %84 %91 -OpSelectionMerge %93 None -OpBranchConditional %92 %94 %93 +%86 = OpFunction %7 None %87 +%83 = OpFunctionParameter %9 +%84 = OpFunctionParameter %11 +%85 = OpFunctionParameter %6 +%82 = OpLabel +%88 = OpLoad %10 %26 +OpBranch %89 +%89 = OpLabel +OpLine %3 19 11 +%90 = OpBitcast %6 %84 +%91 = OpCompositeConstruct %13 %83 %90 +%92 = OpImageQueryLevels %6 %88 +%93 = OpULessThan %53 %85 %92 +OpSelectionMerge %94 None +OpBranchConditional %93 %95 %94 +%95 = OpLabel +%96 = OpImageQuerySizeLod %13 %88 %85 +%98 = OpULessThan %97 %91 %96 +%99 = OpAll %53 %98 +OpBranchConditional %99 %100 %94 +%100 = OpLabel +%101 = OpImageFetch %7 %88 %91 Lod %85 +OpBranch %94 %94 = OpLabel -%95 = OpImageQuerySizeLod %12 %87 %84 -%97 = OpULessThan %96 %90 %95 -%98 = OpAll %52 %97 -OpBranchConditional %98 %99 %93 -%99 = OpLabel -%100 = OpImageFetch %6 %87 %90 Lod %84 -OpBranch %93 -%93 = OpLabel -%101 = OpPhi %6 %53 %88 %53 %94 %100 %99 -OpReturnValue %101 +%102 = OpPhi %7 %54 %89 %54 %95 %101 %100 +OpReturnValue %102 OpFunctionEnd -%106 = OpFunction %6 None %107 -%103 = OpFunctionParameter %8 -%104 = OpFunctionParameter %5 -%105 = OpFunctionParameter %5 -%102 = OpLabel -%108 = OpLoad %9 %25 -OpBranch %109 -%109 = OpLabel -%110 = OpCompositeConstruct %12 %103 %104 -%111 = OpImageQueryLevels %5 %108 -%112 = OpULessThan %52 %105 %111 -OpSelectionMerge %113 None -OpBranchConditional %112 %114 %113 +%107 = OpFunction %7 None %108 +%104 = OpFunctionParameter %9 +%105 = OpFunctionParameter %6 +%106 = OpFunctionParameter %6 +%103 = OpLabel +%109 = OpLoad %10 %26 +OpBranch %110 +%110 = OpLabel +OpLine %3 23 11 +%111 = OpCompositeConstruct %13 %104 %105 +%112 = OpImageQueryLevels %6 %109 +%113 = OpULessThan %53 %106 %112 +OpSelectionMerge %114 None +OpBranchConditional %113 %115 %114 +%115 = OpLabel +%116 = OpImageQuerySizeLod %13 %109 %106 +%117 = OpULessThan %97 %111 %116 +%118 = OpAll %53 %117 +OpBranchConditional %118 %119 %114 +%119 = OpLabel +%120 = OpImageFetch %7 %109 %111 Lod %106 +OpBranch %114 %114 = OpLabel -%115 = OpImageQuerySizeLod %12 %108 %105 -%116 = OpULessThan %96 %110 %115 -%117 = OpAll %52 %116 -OpBranchConditional %117 %118 %113 -%118 = OpLabel -%119 = OpImageFetch %6 %108 %110 Lod %105 -OpBranch %113 -%113 = OpLabel -%120 = OpPhi %6 %53 %109 %53 %114 %119 %118 -OpReturnValue %120 +%121 = OpPhi %7 %54 %110 %54 %115 %120 %119 +OpReturnValue %121 OpFunctionEnd -%124 = OpFunction %6 None %125 -%122 = OpFunctionParameter %12 -%123 = OpFunctionParameter %5 -%121 = OpLabel -%126 = OpLoad %11 %27 -OpBranch %127 -%127 = OpLabel -%128 = OpImageQueryLevels %5 %126 -%129 = OpULessThan %52 %123 %128 -OpSelectionMerge %130 None -OpBranchConditional %129 %131 %130 +%125 = OpFunction %7 None %126 +%123 = OpFunctionParameter %13 +%124 = OpFunctionParameter %6 +%122 = OpLabel +%127 = OpLoad %12 %28 +OpBranch %128 +%128 = OpLabel +OpLine %3 30 11 +%129 = OpImageQueryLevels %6 %127 +%130 = OpULessThan %53 %124 %129 +OpSelectionMerge %131 None +OpBranchConditional %130 %132 %131 +%132 = OpLabel +%133 = OpImageQuerySizeLod %13 %127 %124 +%134 = OpULessThan %97 %123 %133 +%135 = OpAll %53 %134 +OpBranchConditional %135 %136 %131 +%136 = OpLabel +%137 = OpImageFetch %7 %127 %123 Lod %124 +OpBranch %131 %131 = OpLabel -%132 = OpImageQuerySizeLod %12 %126 %123 -%133 = OpULessThan %96 %122 %132 -%134 = OpAll %52 %133 -OpBranchConditional %134 %135 %130 -%135 = OpLabel -%136 = OpImageFetch %6 %126 %122 Lod %123 -OpBranch %130 -%130 = OpLabel -%137 = OpPhi %6 %53 %127 %53 %131 %136 %135 -OpReturnValue %137 +%138 = OpPhi %7 %54 %128 %54 %132 %137 %136 +OpReturnValue %138 OpFunctionEnd -%141 = OpFunction %6 None %67 -%139 = OpFunctionParameter %8 -%140 = OpFunctionParameter %5 -%138 = OpLabel -%142 = OpLoad %13 %29 -OpBranch %143 -%143 = OpLabel -%144 = OpImageQuerySamples %5 %142 -%145 = OpULessThan %52 %140 %144 -OpSelectionMerge %146 None -OpBranchConditional %145 %147 %146 +%142 = OpFunction %7 None %68 +%140 = OpFunctionParameter %9 +%141 = OpFunctionParameter %6 +%139 = OpLabel +%143 = OpLoad %14 %30 +OpBranch %144 +%144 = OpLabel +OpLine %3 37 11 +%145 = OpImageQuerySamples %6 %143 +%146 = OpULessThan %53 %141 %145 +OpSelectionMerge %147 None +OpBranchConditional %146 %148 %147 +%148 = OpLabel +%149 = OpImageQuerySize %9 %143 +%150 = OpULessThan %76 %140 %149 +%151 = OpAll %53 %150 +OpBranchConditional %151 %152 %147 +%152 = OpLabel +%153 = OpImageFetch %7 %143 %140 Sample %141 +OpBranch %147 %147 = OpLabel -%148 = OpImageQuerySize %8 %142 -%149 = OpULessThan %75 %139 %148 -%150 = OpAll %52 %149 -OpBranchConditional %150 %151 %146 -%151 = OpLabel -%152 = OpImageFetch %6 %142 %139 Sample %140 -OpBranch %146 -%146 = OpLabel -%153 = OpPhi %6 %53 %143 %53 %147 %152 %151 -OpReturnValue %153 +%154 = OpPhi %7 %54 %144 %54 %148 %153 %152 +OpReturnValue %154 OpFunctionEnd -%157 = OpFunction %4 None %158 -%155 = OpFunctionParameter %8 -%156 = OpFunctionParameter %5 -%154 = OpLabel -%159 = OpLoad %14 %31 -OpBranch %160 -%160 = OpLabel -%161 = OpImageQueryLevels %5 %159 -%162 = OpULessThan %52 %156 %161 -OpSelectionMerge %163 None -OpBranchConditional %162 %164 %163 +%158 = OpFunction %5 None %159 +%156 = OpFunctionParameter %9 +%157 = OpFunctionParameter %6 +%155 = OpLabel +%160 = OpLoad %15 %32 +OpBranch %161 +%161 = OpLabel +OpLine %3 44 11 +%162 = OpImageQueryLevels %6 %160 +%163 = OpULessThan %53 %157 %162 +OpSelectionMerge %164 None +OpBranchConditional %163 %165 %164 +%165 = OpLabel +%166 = OpImageQuerySizeLod %9 %160 %157 +%167 = OpULessThan %76 %156 %166 +%168 = OpAll %53 %167 +OpBranchConditional %168 %169 %164 +%169 = OpLabel +%170 = OpImageFetch %7 %160 %156 Lod %157 +OpBranch %164 %164 = OpLabel -%165 = OpImageQuerySizeLod %8 %159 %156 -%166 = OpULessThan %75 %155 %165 -%167 = OpAll %52 %166 -OpBranchConditional %167 %168 %163 -%168 = OpLabel -%169 = OpImageFetch %6 %159 %155 Lod %156 -OpBranch %163 -%163 = OpLabel -%170 = OpPhi %6 %53 %160 %53 %164 %169 %168 -%171 = OpCompositeExtract %4 %170 0 -OpReturnValue %171 +%171 = OpPhi %7 %54 %161 %54 %165 %170 %169 +%172 = OpCompositeExtract %5 %171 0 +OpReturnValue %172 OpFunctionEnd -%176 = OpFunction %4 None %177 -%173 = OpFunctionParameter %8 -%174 = OpFunctionParameter %10 -%175 = OpFunctionParameter %5 -%172 = OpLabel -%178 = OpLoad %15 %33 -OpBranch %179 -%179 = OpLabel -%180 = OpBitcast %5 %174 -%181 = OpCompositeConstruct %12 %173 %180 -%182 = OpImageQueryLevels %5 %178 -%183 = OpULessThan %52 %175 %182 -OpSelectionMerge %184 None -OpBranchConditional %183 %185 %184 +%177 = OpFunction %5 None %178 +%174 = OpFunctionParameter %9 +%175 = OpFunctionParameter %11 +%176 = OpFunctionParameter %6 +%173 = OpLabel +%179 = OpLoad %16 %34 +OpBranch %180 +%180 = OpLabel +OpLine %3 51 11 +%181 = OpBitcast %6 %175 +%182 = OpCompositeConstruct %13 %174 %181 +%183 = OpImageQueryLevels %6 %179 +%184 = OpULessThan %53 %176 %183 +OpSelectionMerge %185 None +OpBranchConditional %184 %186 %185 +%186 = OpLabel +%187 = OpImageQuerySizeLod %13 %179 %176 +%188 = OpULessThan %97 %182 %187 +%189 = OpAll %53 %188 +OpBranchConditional %189 %190 %185 +%190 = OpLabel +%191 = OpImageFetch %7 %179 %182 Lod %176 +OpBranch %185 %185 = OpLabel -%186 = OpImageQuerySizeLod %12 %178 %175 -%187 = OpULessThan %96 %181 %186 -%188 = OpAll %52 %187 -OpBranchConditional %188 %189 %184 -%189 = OpLabel -%190 = OpImageFetch %6 %178 %181 Lod %175 -OpBranch %184 -%184 = OpLabel -%191 = OpPhi %6 %53 %179 %53 %185 %190 %189 -%192 = OpCompositeExtract %4 %191 0 -OpReturnValue %192 +%192 = OpPhi %7 %54 %180 %54 %186 %191 %190 +%193 = OpCompositeExtract %5 %192 0 +OpReturnValue %193 OpFunctionEnd -%197 = OpFunction %4 None %198 -%194 = OpFunctionParameter %8 -%195 = OpFunctionParameter %5 -%196 = OpFunctionParameter %5 -%193 = OpLabel -%199 = OpLoad %15 %33 -OpBranch %200 -%200 = OpLabel -%201 = OpCompositeConstruct %12 %194 %195 -%202 = OpImageQueryLevels %5 %199 -%203 = OpULessThan %52 %196 %202 -OpSelectionMerge %204 None -OpBranchConditional %203 %205 %204 +%198 = OpFunction %5 None %199 +%195 = OpFunctionParameter %9 +%196 = OpFunctionParameter %6 +%197 = OpFunctionParameter %6 +%194 = OpLabel +%200 = OpLoad %16 %34 +OpBranch %201 +%201 = OpLabel +OpLine %3 55 11 +%202 = OpCompositeConstruct %13 %195 %196 +%203 = OpImageQueryLevels %6 %200 +%204 = OpULessThan %53 %197 %203 +OpSelectionMerge %205 None +OpBranchConditional %204 %206 %205 +%206 = OpLabel +%207 = OpImageQuerySizeLod %13 %200 %197 +%208 = OpULessThan %97 %202 %207 +%209 = OpAll %53 %208 +OpBranchConditional %209 %210 %205 +%210 = OpLabel +%211 = OpImageFetch %7 %200 %202 Lod %197 +OpBranch %205 %205 = OpLabel -%206 = OpImageQuerySizeLod %12 %199 %196 -%207 = OpULessThan %96 %201 %206 -%208 = OpAll %52 %207 -OpBranchConditional %208 %209 %204 -%209 = OpLabel -%210 = OpImageFetch %6 %199 %201 Lod %196 -OpBranch %204 -%204 = OpLabel -%211 = OpPhi %6 %53 %200 %53 %205 %210 %209 -%212 = OpCompositeExtract %4 %211 0 -OpReturnValue %212 +%212 = OpPhi %7 %54 %201 %54 %206 %211 %210 +%213 = OpCompositeExtract %5 %212 0 +OpReturnValue %213 OpFunctionEnd -%216 = OpFunction %4 None %158 -%214 = OpFunctionParameter %8 -%215 = OpFunctionParameter %5 -%213 = OpLabel -%217 = OpLoad %16 %35 -OpBranch %218 -%218 = OpLabel -%219 = OpImageQuerySamples %5 %217 -%220 = OpULessThan %52 %215 %219 -OpSelectionMerge %221 None -OpBranchConditional %220 %222 %221 +%217 = OpFunction %5 None %159 +%215 = OpFunctionParameter %9 +%216 = OpFunctionParameter %6 +%214 = OpLabel +%218 = OpLoad %17 %36 +OpBranch %219 +%219 = OpLabel +OpLine %3 62 11 +%220 = OpImageQuerySamples %6 %218 +%221 = OpULessThan %53 %216 %220 +OpSelectionMerge %222 None +OpBranchConditional %221 %223 %222 +%223 = OpLabel +%224 = OpImageQuerySize %9 %218 +%225 = OpULessThan %76 %215 %224 +%226 = OpAll %53 %225 +OpBranchConditional %226 %227 %222 +%227 = OpLabel +%228 = OpImageFetch %7 %218 %215 Sample %216 +OpBranch %222 %222 = OpLabel -%223 = OpImageQuerySize %8 %217 -%224 = OpULessThan %75 %214 %223 -%225 = OpAll %52 %224 -OpBranchConditional %225 %226 %221 -%226 = OpLabel -%227 = OpImageFetch %6 %217 %214 Sample %215 -OpBranch %221 -%221 = OpLabel -%228 = OpPhi %6 %53 %218 %53 %222 %227 %226 -%229 = OpCompositeExtract %4 %228 0 -OpReturnValue %229 +%229 = OpPhi %7 %54 %219 %54 %223 %228 %227 +%230 = OpCompositeExtract %5 %229 0 +OpReturnValue %230 OpFunctionEnd -%233 = OpFunction %2 None %234 -%231 = OpFunctionParameter %5 +%234 = OpFunction %2 None %235 %232 = OpFunctionParameter %6 -%230 = OpLabel -%235 = OpLoad %17 %37 -OpBranch %236 -%236 = OpLabel -OpImageWrite %235 %231 %232 -OpReturn -OpFunctionEnd -%240 = OpFunction %2 None %241 -%238 = OpFunctionParameter %8 -%239 = OpFunctionParameter %6 +%233 = OpFunctionParameter %7 +%231 = OpLabel +%236 = OpLoad %18 %38 +OpBranch %237 %237 = OpLabel -%242 = OpLoad %18 %39 -OpBranch %243 -%243 = OpLabel -OpImageWrite %242 %238 %239 +OpLine %3 69 5 +OpImageWrite %236 %232 %233 OpReturn OpFunctionEnd -%248 = OpFunction %2 None %249 -%245 = OpFunctionParameter %8 -%246 = OpFunctionParameter %10 -%247 = OpFunctionParameter %6 +%241 = OpFunction %2 None %242 +%239 = OpFunctionParameter %9 +%240 = OpFunctionParameter %7 +%238 = OpLabel +%243 = OpLoad %19 %40 +OpBranch %244 %244 = OpLabel -%250 = OpLoad %19 %41 -OpBranch %251 -%251 = OpLabel -%252 = OpBitcast %5 %246 -%253 = OpCompositeConstruct %12 %245 %252 -OpImageWrite %250 %253 %247 +OpLine %3 76 5 +OpImageWrite %243 %239 %240 OpReturn OpFunctionEnd -%258 = OpFunction %2 None %259 -%255 = OpFunctionParameter %8 -%256 = OpFunctionParameter %5 +%249 = OpFunction %2 None %250 +%246 = OpFunctionParameter %9 +%247 = OpFunctionParameter %11 +%248 = OpFunctionParameter %7 +%245 = OpLabel +%251 = OpLoad %20 %42 +OpBranch %252 +%252 = OpLabel +OpLine %3 83 2 +%253 = OpBitcast %6 %247 +%254 = OpCompositeConstruct %13 %246 %253 +OpImageWrite %251 %254 %248 +OpReturn +OpFunctionEnd +%259 = OpFunction %2 None %260 +%256 = OpFunctionParameter %9 %257 = OpFunctionParameter %6 -%254 = OpLabel -%260 = OpLoad %19 %41 -OpBranch %261 -%261 = OpLabel -%262 = OpCompositeConstruct %12 %255 %256 -OpImageWrite %260 %262 %257 +%258 = OpFunctionParameter %7 +%255 = OpLabel +%261 = OpLoad %20 %42 +OpBranch %262 +%262 = OpLabel +OpLine %3 87 2 +%263 = OpCompositeConstruct %13 %256 %257 +OpImageWrite %261 %263 %258 OpReturn OpFunctionEnd -%266 = OpFunction %2 None %267 -%264 = OpFunctionParameter %12 -%265 = OpFunctionParameter %6 -%263 = OpLabel -%268 = OpLoad %20 %43 -OpBranch %269 -%269 = OpLabel -OpImageWrite %268 %264 %265 -OpReturn -OpFunctionEnd -%273 = OpFunction %2 None %274 +%267 = OpFunction %2 None %268 +%265 = OpFunctionParameter %13 +%266 = OpFunctionParameter %7 +%264 = OpLabel +%269 = OpLoad %21 %44 +OpBranch %270 %270 = OpLabel -%275 = OpLoad %3 %21 -%276 = OpLoad %7 %23 -%277 = OpLoad %9 %25 -%278 = OpLoad %11 %27 -%279 = OpLoad %13 %29 -%280 = OpLoad %17 %37 -%281 = OpLoad %18 %39 -%282 = OpLoad %19 %41 -%283 = OpLoad %20 %43 -OpBranch %290 -%290 = OpLabel -%291 = OpFunctionCall %6 %48 %284 %284 -%292 = OpFunctionCall %6 %66 %285 %284 -%293 = OpFunctionCall %6 %85 %285 %286 %284 -%294 = OpFunctionCall %6 %106 %285 %284 %284 -%295 = OpFunctionCall %6 %124 %287 %284 -%296 = OpFunctionCall %6 %141 %285 %284 -%297 = OpFunctionCall %2 %233 %284 %53 -%298 = OpFunctionCall %2 %240 %285 %53 -%299 = OpFunctionCall %2 %248 %285 %286 %53 -%300 = OpFunctionCall %2 %258 %285 %284 %53 -%301 = OpFunctionCall %2 %266 %287 %53 -OpStore %271 %289 +OpLine %3 94 5 +OpImageWrite %269 %265 %266 +OpReturn +OpFunctionEnd +%274 = OpFunction %2 None %275 +%271 = OpLabel +%276 = OpLoad %4 %22 +%277 = OpLoad %8 %24 +%278 = OpLoad %10 %26 +%279 = OpLoad %12 %28 +%280 = OpLoad %14 %30 +%281 = OpLoad %18 %38 +%282 = OpLoad %19 %40 +%283 = OpLoad %20 %42 +%284 = OpLoad %21 %44 +OpBranch %291 +%291 = OpLabel +OpLine %3 101 5 +%292 = OpFunctionCall %7 %49 %285 %285 +OpLine %3 102 5 +%293 = OpFunctionCall %7 %67 %286 %285 +OpLine %3 103 5 +%294 = OpFunctionCall %7 %86 %286 %287 %285 +OpLine %3 104 5 +%295 = OpFunctionCall %7 %107 %286 %285 %285 +OpLine %3 105 5 +%296 = OpFunctionCall %7 %125 %288 %285 +OpLine %3 106 5 +%297 = OpFunctionCall %7 %142 %286 %285 +OpLine %3 112 5 +%298 = OpFunctionCall %2 %234 %285 %54 +OpLine %3 113 5 +%299 = OpFunctionCall %2 %241 %286 %54 +OpLine %3 114 5 +%300 = OpFunctionCall %2 %249 %286 %287 %54 +OpLine %3 115 5 +%301 = OpFunctionCall %2 %259 %286 %285 %54 +OpLine %3 116 5 +%302 = OpFunctionCall %2 %267 %288 %54 +OpLine %3 118 12 +OpStore %272 %290 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/collatz.spvasm b/naga/tests/out/spv/collatz.spvasm index 6c6cfb4f91..cc670722ae 100644 --- a/naga/tests/out/spv/collatz.spvasm +++ b/naga/tests/out/spv/collatz.spvasm @@ -1,135 +1,192 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 77 +; Bound: 78 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %66 "main" %63 -OpExecutionMode %66 LocalSize 1 1 1 -OpMemberName %5 0 "data" -OpName %5 "PrimeIndices" -OpName %7 "v_indices" -OpName %9 "naga_mod" -OpName %11 "lhs" -OpName %12 "rhs" -OpName %20 "naga_div" -OpName %21 "lhs" -OpName %22 "rhs" -OpName %28 "n_base" -OpName %29 "collatz_iterations" -OpName %33 "n" -OpName %36 "i" -OpName %63 "global_id" -OpName %66 "main" -OpDecorate %4 ArrayStride 4 -OpMemberDecorate %5 0 Offset 0 -OpDecorate %5 Block -OpDecorate %7 DescriptorSet 0 -OpDecorate %7 Binding 0 -OpDecorate %63 BuiltIn GlobalInvocationId +OpEntryPoint GLCompute %67 "main" %64 +OpExecutionMode %67 LocalSize 1 1 1 +%3 = OpString "collatz.wgsl" +OpSource Unknown 0 %3 "struct PrimeIndices { + data: array +} // this is used as both input and output for convenience + +@group(0) @binding(0) +var v_indices: PrimeIndices; + +// The Collatz Conjecture states that for any integer n: +// If n is even, n = n/2 +// If n is odd, n = 3n+1 +// And repeat this process for each new n, you will always eventually reach 1. +// Though the conjecture has not been proven, no counterexample has ever been found. +// This function returns how many times this recurrence needs to be applied to reach 1. +fn collatz_iterations(n_base: u32) -> u32 { + var n = n_base; + var i: u32 = 0u; + while n > 1u { + if n % 2u == 0u { + n = n / 2u; + } + else { + n = 3u * n + 1u; + } + i = i + 1u; + } + return i; +} + +@compute @workgroup_size(1) +fn main(@builtin(global_invocation_id) global_id: vec3) { + v_indices.data[global_id.x] = collatz_iterations(v_indices.data[global_id.x]); +} +" +OpMemberName %6 0 "data" +OpName %6 "PrimeIndices" +OpName %8 "v_indices" +OpName %10 "naga_mod" +OpName %12 "lhs" +OpName %13 "rhs" +OpName %21 "naga_div" +OpName %22 "lhs" +OpName %23 "rhs" +OpName %29 "n_base" +OpName %30 "collatz_iterations" +OpName %34 "n" +OpName %37 "i" +OpName %64 "global_id" +OpName %67 "main" +OpDecorate %5 ArrayStride 4 +OpMemberDecorate %6 0 Offset 0 +OpDecorate %6 Block +OpDecorate %8 DescriptorSet 0 +OpDecorate %8 Binding 0 +OpDecorate %64 BuiltIn GlobalInvocationId %2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%4 = OpTypeRuntimeArray %3 -%5 = OpTypeStruct %4 -%6 = OpTypeVector %3 3 -%8 = OpTypePointer StorageBuffer %5 -%7 = OpVariable %8 StorageBuffer -%10 = OpTypeFunction %3 %3 %3 -%14 = OpTypeBool -%15 = OpConstant %3 0 -%17 = OpConstant %3 1 -%30 = OpTypeFunction %3 %3 -%31 = OpConstant %3 2 -%32 = OpConstant %3 3 -%34 = OpTypePointer Function %3 -%35 = OpConstantNull %3 -%64 = OpTypePointer Input %6 -%63 = OpVariable %64 Input -%67 = OpTypeFunction %2 -%69 = OpTypePointer StorageBuffer %4 -%71 = OpTypePointer StorageBuffer %3 -%9 = OpFunction %3 None %10 -%11 = OpFunctionParameter %3 -%12 = OpFunctionParameter %3 -%13 = OpLabel -%16 = OpIEqual %14 %12 %15 -%18 = OpSelect %3 %16 %17 %12 -%19 = OpUMod %3 %11 %18 -OpReturnValue %19 +%4 = OpTypeInt 32 0 +%5 = OpTypeRuntimeArray %4 +%6 = OpTypeStruct %5 +%7 = OpTypeVector %4 3 +%9 = OpTypePointer StorageBuffer %6 +%8 = OpVariable %9 StorageBuffer +%11 = OpTypeFunction %4 %4 %4 +%15 = OpTypeBool +%16 = OpConstant %4 0 +%18 = OpConstant %4 1 +%31 = OpTypeFunction %4 %4 +%32 = OpConstant %4 2 +%33 = OpConstant %4 3 +%35 = OpTypePointer Function %4 +%36 = OpConstantNull %4 +%65 = OpTypePointer Input %7 +%64 = OpVariable %65 Input +%68 = OpTypeFunction %2 +%70 = OpTypePointer StorageBuffer %5 +%72 = OpTypePointer StorageBuffer %4 +%10 = OpFunction %4 None %11 +%12 = OpFunctionParameter %4 +%13 = OpFunctionParameter %4 +%14 = OpLabel +%17 = OpIEqual %15 %13 %16 +%19 = OpSelect %4 %17 %18 %13 +%20 = OpUMod %4 %12 %19 +OpReturnValue %20 OpFunctionEnd -%20 = OpFunction %3 None %10 -%21 = OpFunctionParameter %3 -%22 = OpFunctionParameter %3 -%23 = OpLabel -%24 = OpIEqual %14 %22 %15 -%25 = OpSelect %3 %24 %17 %22 -%26 = OpUDiv %3 %21 %25 -OpReturnValue %26 +%21 = OpFunction %4 None %11 +%22 = OpFunctionParameter %4 +%23 = OpFunctionParameter %4 +%24 = OpLabel +%25 = OpIEqual %15 %23 %16 +%26 = OpSelect %4 %25 %18 %23 +%27 = OpUDiv %4 %22 %26 +OpReturnValue %27 OpFunctionEnd -%29 = OpFunction %3 None %30 -%28 = OpFunctionParameter %3 -%27 = OpLabel -%33 = OpVariable %34 Function %35 -%36 = OpVariable %34 Function %15 -OpBranch %37 -%37 = OpLabel -OpStore %33 %28 +%30 = OpFunction %4 None %31 +%29 = OpFunctionParameter %4 +%28 = OpLabel +%34 = OpVariable %35 Function %36 +%37 = OpVariable %35 Function %16 OpBranch %38 %38 = OpLabel -OpLoopMerge %39 %41 None -OpBranch %40 -%40 = OpLabel -%42 = OpLoad %3 %33 -%43 = OpUGreaterThan %14 %42 %17 -OpSelectionMerge %44 None -OpBranchConditional %43 %44 %45 -%45 = OpLabel +OpLine %3 15 5 +OpStore %34 %29 OpBranch %39 -%44 = OpLabel -OpBranch %46 -%46 = OpLabel -%48 = OpLoad %3 %33 -%49 = OpFunctionCall %3 %9 %48 %31 -%50 = OpIEqual %14 %49 %15 -OpSelectionMerge %51 None -OpBranchConditional %50 %52 %53 -%52 = OpLabel -%54 = OpLoad %3 %33 -%55 = OpFunctionCall %3 %20 %54 %31 -OpStore %33 %55 -OpBranch %51 -%53 = OpLabel -%56 = OpLoad %3 %33 -%57 = OpIMul %3 %32 %56 -%58 = OpIAdd %3 %57 %17 -OpStore %33 %58 -OpBranch %51 -%51 = OpLabel -%59 = OpLoad %3 %36 -%60 = OpIAdd %3 %59 %17 -OpStore %36 %60 -OpBranch %47 -%47 = OpLabel +%39 = OpLabel +OpLine %3 17 5 +OpLoopMerge %40 %42 None OpBranch %41 %41 = OpLabel -OpBranch %38 -%39 = OpLabel -%61 = OpLoad %3 %36 -OpReturnValue %61 +OpLine %3 1 1 +%43 = OpLoad %4 %34 +OpLine %3 17 11 +%44 = OpUGreaterThan %15 %43 %18 +OpLine %3 17 10 +OpSelectionMerge %45 None +OpBranchConditional %44 %45 %46 +%46 = OpLabel +OpBranch %40 +%45 = OpLabel +OpBranch %47 +%47 = OpLabel +OpLine %3 1 1 +%49 = OpLoad %4 %34 +OpLine %3 18 12 +%50 = OpFunctionCall %4 %10 %49 %32 +OpLine %3 18 12 +%51 = OpIEqual %15 %50 %16 +OpLine %3 18 9 +OpSelectionMerge %52 None +OpBranchConditional %51 %53 %54 +%53 = OpLabel +OpLine %3 1 1 +%55 = OpLoad %4 %34 +OpLine %3 19 17 +%56 = OpFunctionCall %4 %21 %55 %32 +OpLine %3 19 13 +OpStore %34 %56 +OpBranch %52 +%54 = OpLabel +OpLine %3 22 17 +%57 = OpLoad %4 %34 +%58 = OpIMul %4 %33 %57 +OpLine %3 22 17 +%59 = OpIAdd %4 %58 %18 +OpLine %3 22 13 +OpStore %34 %59 +OpBranch %52 +%52 = OpLabel +OpLine %3 1 1 +%60 = OpLoad %4 %37 +OpLine %3 24 13 +%61 = OpIAdd %4 %60 %18 +OpLine %3 24 9 +OpStore %37 %61 +OpBranch %48 +%48 = OpLabel +OpBranch %42 +%42 = OpLabel +OpBranch %39 +%40 = OpLabel +OpLine %3 1 1 +%62 = OpLoad %4 %37 +OpReturnValue %62 OpFunctionEnd -%66 = OpFunction %2 None %67 -%62 = OpLabel -%65 = OpLoad %6 %63 -OpBranch %68 -%68 = OpLabel -%70 = OpCompositeExtract %3 %65 0 -%72 = OpCompositeExtract %3 %65 0 -%73 = OpAccessChain %71 %7 %15 %72 -%74 = OpLoad %3 %73 -%75 = OpFunctionCall %3 %29 %74 -%76 = OpAccessChain %71 %7 %15 %70 -OpStore %76 %75 +%67 = OpFunction %2 None %68 +%63 = OpLabel +%66 = OpLoad %7 %64 +OpBranch %69 +%69 = OpLabel +OpLine %3 31 5 +%71 = OpCompositeExtract %4 %66 0 +OpLine %3 31 54 +%73 = OpCompositeExtract %4 %66 0 +%74 = OpAccessChain %72 %8 %16 %73 +%75 = OpLoad %4 %74 +OpLine %3 31 35 +%76 = OpFunctionCall %4 %30 %75 +OpLine %3 31 5 +%77 = OpAccessChain %72 %8 %16 %71 +OpStore %77 %76 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/image.spvasm b/naga/tests/out/spv/image.spvasm index 7a34bed86e..6b5ef8c890 100644 --- a/naga/tests/out/spv/image.spvasm +++ b/naga/tests/out/spv/image.spvasm @@ -1,7 +1,7 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 546 +; Bound: 547 OpCapability Shader OpCapability Image1D OpCapability Sampled1D @@ -9,717 +9,1047 @@ OpCapability SampledCubeArray OpCapability ImageQuery %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %99 "main" %96 -OpEntryPoint GLCompute %190 "depth_load" %188 -OpEntryPoint Vertex %210 "queries" %208 -OpEntryPoint Vertex %262 "levels_queries" %261 -OpEntryPoint Fragment %293 "texture_sample" %292 -OpEntryPoint Fragment %439 "texture_sample_comparison" %437 -OpEntryPoint Fragment %495 "gather" %494 -OpEntryPoint Fragment %529 "depth_no_comparison" %528 -OpExecutionMode %99 LocalSize 16 1 1 -OpExecutionMode %190 LocalSize 16 1 1 -OpExecutionMode %293 OriginUpperLeft -OpExecutionMode %439 OriginUpperLeft -OpExecutionMode %495 OriginUpperLeft -OpExecutionMode %529 OriginUpperLeft -OpName %31 "image_mipmapped_src" -OpName %33 "image_multisampled_src" -OpName %35 "image_depth_multisampled_src" -OpName %37 "image_storage_src" -OpName %39 "image_array_src" -OpName %41 "image_dup_src" -OpName %43 "image_1d_src" -OpName %45 "image_dst" -OpName %47 "image_1d" -OpName %49 "image_2d" -OpName %51 "image_2d_u32" -OpName %52 "image_2d_i32" -OpName %54 "image_2d_array" -OpName %56 "image_cube" -OpName %58 "image_cube_array" -OpName %60 "image_3d" -OpName %62 "image_aa" -OpName %64 "sampler_reg" -OpName %66 "sampler_cmp" -OpName %68 "image_2d_depth" -OpName %70 "image_2d_array_depth" -OpName %72 "image_cube_depth" -OpName %74 "naga_mod" -OpName %76 "lhs" -OpName %77 "rhs" -OpName %96 "local_id" -OpName %99 "main" -OpName %188 "local_id" -OpName %190 "depth_load" -OpName %210 "queries" -OpName %262 "levels_queries" -OpName %293 "texture_sample" -OpName %306 "a" -OpName %439 "texture_sample_comparison" -OpName %444 "a" -OpName %495 "gather" -OpName %529 "depth_no_comparison" -OpDecorate %31 DescriptorSet 0 -OpDecorate %31 Binding 0 -OpDecorate %33 DescriptorSet 0 -OpDecorate %33 Binding 3 -OpDecorate %35 DescriptorSet 0 -OpDecorate %35 Binding 4 -OpDecorate %37 NonWritable -OpDecorate %37 DescriptorSet 0 -OpDecorate %37 Binding 1 -OpDecorate %39 DescriptorSet 0 -OpDecorate %39 Binding 5 -OpDecorate %41 NonWritable -OpDecorate %41 DescriptorSet 0 -OpDecorate %41 Binding 6 -OpDecorate %43 DescriptorSet 0 -OpDecorate %43 Binding 7 -OpDecorate %45 NonReadable -OpDecorate %45 DescriptorSet 0 -OpDecorate %45 Binding 2 -OpDecorate %47 DescriptorSet 0 -OpDecorate %47 Binding 0 -OpDecorate %49 DescriptorSet 0 -OpDecorate %49 Binding 1 -OpDecorate %51 DescriptorSet 0 -OpDecorate %51 Binding 2 +OpEntryPoint GLCompute %100 "main" %97 +OpEntryPoint GLCompute %191 "depth_load" %189 +OpEntryPoint Vertex %211 "queries" %209 +OpEntryPoint Vertex %263 "levels_queries" %262 +OpEntryPoint Fragment %294 "texture_sample" %293 +OpEntryPoint Fragment %440 "texture_sample_comparison" %438 +OpEntryPoint Fragment %496 "gather" %495 +OpEntryPoint Fragment %530 "depth_no_comparison" %529 +OpExecutionMode %100 LocalSize 16 1 1 +OpExecutionMode %191 LocalSize 16 1 1 +OpExecutionMode %294 OriginUpperLeft +OpExecutionMode %440 OriginUpperLeft +OpExecutionMode %496 OriginUpperLeft +OpExecutionMode %530 OriginUpperLeft +%3 = OpString "image.wgsl" +OpSource Unknown 0 %3 "@group(0) @binding(0) +var image_mipmapped_src: texture_2d; +@group(0) @binding(3) +var image_multisampled_src: texture_multisampled_2d; +@group(0) @binding(4) +var image_depth_multisampled_src: texture_depth_multisampled_2d; +@group(0) @binding(1) +var image_storage_src: texture_storage_2d; +@group(0) @binding(5) +var image_array_src: texture_2d_array; +@group(0) @binding(6) +var image_dup_src: texture_storage_1d; // for #1307 +@group(0) @binding(7) +var image_1d_src: texture_1d; +@group(0) @binding(2) +var image_dst: texture_storage_1d; + +@compute @workgroup_size(16) +fn main(@builtin(local_invocation_id) local_id: vec3) { + let dim = textureDimensions(image_storage_src); + let itc = vec2(dim * local_id.xy) % vec2(10, 20); + // loads with ivec2 coords. + let value1 = textureLoad(image_mipmapped_src, itc, i32(local_id.z)); + let value2 = textureLoad(image_multisampled_src, itc, i32(local_id.z)); + let value4 = textureLoad(image_storage_src, itc); + let value5 = textureLoad(image_array_src, itc, local_id.z, i32(local_id.z) + 1); + let value6 = textureLoad(image_array_src, itc, i32(local_id.z), i32(local_id.z) + 1); + let value7 = textureLoad(image_1d_src, i32(local_id.x), i32(local_id.z)); + // loads with uvec2 coords. + let value1u = textureLoad(image_mipmapped_src, vec2(itc), i32(local_id.z)); + let value2u = textureLoad(image_multisampled_src, vec2(itc), i32(local_id.z)); + let value4u = textureLoad(image_storage_src, vec2(itc)); + let value5u = textureLoad(image_array_src, vec2(itc), local_id.z, i32(local_id.z) + 1); + let value6u = textureLoad(image_array_src, vec2(itc), i32(local_id.z), i32(local_id.z) + 1); + let value7u = textureLoad(image_1d_src, u32(local_id.x), i32(local_id.z)); + // store with ivec2 coords. + textureStore(image_dst, itc.x, value1 + value2 + value4 + value5 + value6); + // store with uvec2 coords. + textureStore(image_dst, u32(itc.x), value1u + value2u + value4u + value5u + value6u); +} + +@compute @workgroup_size(16, 1, 1) +fn depth_load(@builtin(local_invocation_id) local_id: vec3) { + let dim: vec2 = textureDimensions(image_storage_src); + let itc: vec2 = (vec2(dim * local_id.xy) % vec2(10, 20)); + let val: f32 = textureLoad(image_depth_multisampled_src, itc, i32(local_id.z)); + textureStore(image_dst, itc.x, vec4(u32(val))); + return; +} + +@group(0) @binding(0) +var image_1d: texture_1d; +@group(0) @binding(1) +var image_2d: texture_2d; +@group(0) @binding(2) +var image_2d_u32: texture_2d; +@group(0) @binding(3) +var image_2d_i32: texture_2d; +@group(0) @binding(4) +var image_2d_array: texture_2d_array; +@group(0) @binding(5) +var image_cube: texture_cube; +@group(0) @binding(6) +var image_cube_array: texture_cube_array; +@group(0) @binding(7) +var image_3d: texture_3d; +@group(0) @binding(8) +var image_aa: texture_multisampled_2d; + +@vertex +fn queries() -> @builtin(position) vec4 { + let dim_1d = textureDimensions(image_1d); + let dim_1d_lod = textureDimensions(image_1d, i32(dim_1d)); + let dim_2d = textureDimensions(image_2d); + let dim_2d_lod = textureDimensions(image_2d, 1); + let dim_2d_array = textureDimensions(image_2d_array); + let dim_2d_array_lod = textureDimensions(image_2d_array, 1); + let dim_cube = textureDimensions(image_cube); + let dim_cube_lod = textureDimensions(image_cube, 1); + let dim_cube_array = textureDimensions(image_cube_array); + let dim_cube_array_lod = textureDimensions(image_cube_array, 1); + let dim_3d = textureDimensions(image_3d); + let dim_3d_lod = textureDimensions(image_3d, 1); + let dim_2s_ms = textureDimensions(image_aa); + + let sum = dim_1d + dim_2d.y + dim_2d_lod.y + dim_2d_array.y + dim_2d_array_lod.y + + dim_cube.y + dim_cube_lod.y + dim_cube_array.y + dim_cube_array_lod.y + + dim_3d.z + dim_3d_lod.z; + return vec4(f32(sum)); +} + +@vertex +fn levels_queries() -> @builtin(position) vec4 { + let num_levels_2d = textureNumLevels(image_2d); + let num_layers_2d = textureNumLayers(image_2d_array); + let num_levels_2d_array = textureNumLevels(image_2d_array); + let num_layers_2d_array = textureNumLayers(image_2d_array); + let num_levels_cube = textureNumLevels(image_cube); + let num_levels_cube_array = textureNumLevels(image_cube_array); + let num_layers_cube = textureNumLayers(image_cube_array); + let num_levels_3d = textureNumLevels(image_3d); + let num_samples_aa = textureNumSamples(image_aa); + + let sum = num_layers_2d + num_layers_cube + num_samples_aa + + num_levels_2d + num_levels_2d_array + num_levels_3d + num_levels_cube + num_levels_cube_array; + return vec4(f32(sum)); +} + +@group(1) @binding(0) +var sampler_reg: sampler; + +@fragment +fn texture_sample() -> @location(0) vec4 { + let tc = vec2(0.5); + let tc3 = vec3(0.5); + let level = 2.3; + var a: vec4; + a += textureSample(image_1d, sampler_reg, tc.x); + a += textureSample(image_2d, sampler_reg, tc); + a += textureSample(image_2d, sampler_reg, tc, vec2(3, 1)); + a += textureSampleLevel(image_2d, sampler_reg, tc, level); + a += textureSampleLevel(image_2d, sampler_reg, tc, level, vec2(3, 1)); + a += textureSampleBias(image_2d, sampler_reg, tc, 2.0, vec2(3, 1)); + a += textureSample(image_2d_array, sampler_reg, tc, 0u); + a += textureSample(image_2d_array, sampler_reg, tc, 0u, vec2(3, 1)); + a += textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, level); + a += textureSampleLevel(image_2d_array, sampler_reg, tc, 0u, level, vec2(3, 1)); + a += textureSampleBias(image_2d_array, sampler_reg, tc, 0u, 2.0, vec2(3, 1)); + a += textureSample(image_2d_array, sampler_reg, tc, 0); + a += textureSample(image_2d_array, sampler_reg, tc, 0, vec2(3, 1)); + a += textureSampleLevel(image_2d_array, sampler_reg, tc, 0, level); + a += textureSampleLevel(image_2d_array, sampler_reg, tc, 0, level, vec2(3, 1)); + a += textureSampleBias(image_2d_array, sampler_reg, tc, 0, 2.0, vec2(3, 1)); + a += textureSample(image_cube_array, sampler_reg, tc3, 0u); + a += textureSampleLevel(image_cube_array, sampler_reg, tc3, 0u, level); + a += textureSampleBias(image_cube_array, sampler_reg, tc3, 0u, 2.0); + a += textureSample(image_cube_array, sampler_reg, tc3, 0); + a += textureSampleLevel(image_cube_array, sampler_reg, tc3, 0, level); + a += textureSampleBias(image_cube_array, sampler_reg, tc3, 0, 2.0); + return a; +} + +@group(1) @binding(1) +var sampler_cmp: sampler_comparison; +@group(1) @binding(2) +var image_2d_depth: texture_depth_2d; +@group(1) @binding(3) +var image_2d_array_depth: texture_depth_2d_array; +@group(1) @binding(4) +var image_cube_depth: texture_depth_cube; + +@fragment +fn texture_sample_comparison() -> @location(0) f32 { + let tc = vec2(0.5); + let tc3 = vec3(0.5); + let dref = 0.5; + var a: f32; + a += textureSampleCompare(image_2d_depth, sampler_cmp, tc, dref); + a += textureSampleCompare(image_2d_array_depth, sampler_cmp, tc, 0u, dref); + a += textureSampleCompare(image_2d_array_depth, sampler_cmp, tc, 0, dref); + a += textureSampleCompare(image_cube_depth, sampler_cmp, tc3, dref); + a += textureSampleCompareLevel(image_2d_depth, sampler_cmp, tc, dref); + a += textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc, 0u, dref); + a += textureSampleCompareLevel(image_2d_array_depth, sampler_cmp, tc, 0, dref); + a += textureSampleCompareLevel(image_cube_depth, sampler_cmp, tc3, dref); + return a; +} + +@fragment +fn gather() -> @location(0) vec4 { + let tc = vec2(0.5); + let dref = 0.5; + let s2d = textureGather(1, image_2d, sampler_reg, tc); + let s2d_offset = textureGather(3, image_2d, sampler_reg, tc, vec2(3, 1)); + let s2d_depth = textureGatherCompare(image_2d_depth, sampler_cmp, tc, dref); + let s2d_depth_offset = textureGatherCompare(image_2d_depth, sampler_cmp, tc, dref, vec2(3, 1)); + + let u = textureGather(0, image_2d_u32, sampler_reg, tc); + let i = textureGather(0, image_2d_i32, sampler_reg, tc); + let f = vec4(u) + vec4(i); + + return s2d + s2d_offset + s2d_depth + s2d_depth_offset + f; +} + +@fragment +fn depth_no_comparison() -> @location(0) vec4 { + let tc = vec2(0.5); + let level = 1; + let s2d = textureSample(image_2d_depth, sampler_reg, tc); + let s2d_gather = textureGather(image_2d_depth, sampler_reg, tc); + let s2d_level = textureSampleLevel(image_2d_depth, sampler_reg, tc, level); + return s2d + s2d_gather + s2d_level; +} +" +OpName %32 "image_mipmapped_src" +OpName %34 "image_multisampled_src" +OpName %36 "image_depth_multisampled_src" +OpName %38 "image_storage_src" +OpName %40 "image_array_src" +OpName %42 "image_dup_src" +OpName %44 "image_1d_src" +OpName %46 "image_dst" +OpName %48 "image_1d" +OpName %50 "image_2d" +OpName %52 "image_2d_u32" +OpName %53 "image_2d_i32" +OpName %55 "image_2d_array" +OpName %57 "image_cube" +OpName %59 "image_cube_array" +OpName %61 "image_3d" +OpName %63 "image_aa" +OpName %65 "sampler_reg" +OpName %67 "sampler_cmp" +OpName %69 "image_2d_depth" +OpName %71 "image_2d_array_depth" +OpName %73 "image_cube_depth" +OpName %75 "naga_mod" +OpName %77 "lhs" +OpName %78 "rhs" +OpName %97 "local_id" +OpName %100 "main" +OpName %189 "local_id" +OpName %191 "depth_load" +OpName %211 "queries" +OpName %263 "levels_queries" +OpName %294 "texture_sample" +OpName %307 "a" +OpName %440 "texture_sample_comparison" +OpName %445 "a" +OpName %496 "gather" +OpName %530 "depth_no_comparison" +OpDecorate %32 DescriptorSet 0 +OpDecorate %32 Binding 0 +OpDecorate %34 DescriptorSet 0 +OpDecorate %34 Binding 3 +OpDecorate %36 DescriptorSet 0 +OpDecorate %36 Binding 4 +OpDecorate %38 NonWritable +OpDecorate %38 DescriptorSet 0 +OpDecorate %38 Binding 1 +OpDecorate %40 DescriptorSet 0 +OpDecorate %40 Binding 5 +OpDecorate %42 NonWritable +OpDecorate %42 DescriptorSet 0 +OpDecorate %42 Binding 6 +OpDecorate %44 DescriptorSet 0 +OpDecorate %44 Binding 7 +OpDecorate %46 NonReadable +OpDecorate %46 DescriptorSet 0 +OpDecorate %46 Binding 2 +OpDecorate %48 DescriptorSet 0 +OpDecorate %48 Binding 0 +OpDecorate %50 DescriptorSet 0 +OpDecorate %50 Binding 1 OpDecorate %52 DescriptorSet 0 -OpDecorate %52 Binding 3 -OpDecorate %54 DescriptorSet 0 -OpDecorate %54 Binding 4 -OpDecorate %56 DescriptorSet 0 -OpDecorate %56 Binding 5 -OpDecorate %58 DescriptorSet 0 -OpDecorate %58 Binding 6 -OpDecorate %60 DescriptorSet 0 -OpDecorate %60 Binding 7 -OpDecorate %62 DescriptorSet 0 -OpDecorate %62 Binding 8 -OpDecorate %64 DescriptorSet 1 -OpDecorate %64 Binding 0 -OpDecorate %66 DescriptorSet 1 -OpDecorate %66 Binding 1 -OpDecorate %68 DescriptorSet 1 -OpDecorate %68 Binding 2 -OpDecorate %70 DescriptorSet 1 -OpDecorate %70 Binding 3 -OpDecorate %72 DescriptorSet 1 -OpDecorate %72 Binding 4 -OpDecorate %96 BuiltIn LocalInvocationId -OpDecorate %188 BuiltIn LocalInvocationId -OpDecorate %208 BuiltIn Position -OpDecorate %261 BuiltIn Position -OpDecorate %292 Location 0 -OpDecorate %437 Location 0 -OpDecorate %494 Location 0 -OpDecorate %528 Location 0 +OpDecorate %52 Binding 2 +OpDecorate %53 DescriptorSet 0 +OpDecorate %53 Binding 3 +OpDecorate %55 DescriptorSet 0 +OpDecorate %55 Binding 4 +OpDecorate %57 DescriptorSet 0 +OpDecorate %57 Binding 5 +OpDecorate %59 DescriptorSet 0 +OpDecorate %59 Binding 6 +OpDecorate %61 DescriptorSet 0 +OpDecorate %61 Binding 7 +OpDecorate %63 DescriptorSet 0 +OpDecorate %63 Binding 8 +OpDecorate %65 DescriptorSet 1 +OpDecorate %65 Binding 0 +OpDecorate %67 DescriptorSet 1 +OpDecorate %67 Binding 1 +OpDecorate %69 DescriptorSet 1 +OpDecorate %69 Binding 2 +OpDecorate %71 DescriptorSet 1 +OpDecorate %71 Binding 3 +OpDecorate %73 DescriptorSet 1 +OpDecorate %73 Binding 4 +OpDecorate %97 BuiltIn LocalInvocationId +OpDecorate %189 BuiltIn LocalInvocationId +OpDecorate %209 BuiltIn Position +OpDecorate %262 BuiltIn Position +OpDecorate %293 Location 0 +OpDecorate %438 Location 0 +OpDecorate %495 Location 0 +OpDecorate %529 Location 0 %2 = OpTypeVoid -%4 = OpTypeInt 32 0 -%3 = OpTypeImage %4 2D 0 0 0 1 Unknown -%5 = OpTypeImage %4 2D 0 0 1 1 Unknown -%7 = OpTypeFloat 32 -%6 = OpTypeImage %7 2D 1 0 1 1 Unknown -%8 = OpTypeImage %4 2D 0 0 0 2 Rgba8ui -%9 = OpTypeImage %4 2D 0 1 0 1 Unknown -%10 = OpTypeImage %4 1D 0 0 0 2 R32ui -%11 = OpTypeImage %4 1D 0 0 0 1 Unknown -%12 = OpTypeVector %4 3 -%14 = OpTypeInt 32 1 -%13 = OpTypeVector %14 2 -%15 = OpTypeImage %7 1D 0 0 0 1 Unknown -%16 = OpTypeImage %7 2D 0 0 0 1 Unknown -%17 = OpTypeImage %14 2D 0 0 0 1 Unknown -%18 = OpTypeImage %7 2D 0 1 0 1 Unknown -%19 = OpTypeImage %7 Cube 0 0 0 1 Unknown -%20 = OpTypeImage %7 Cube 0 1 0 1 Unknown -%21 = OpTypeImage %7 3D 0 0 0 1 Unknown -%22 = OpTypeImage %7 2D 0 0 1 1 Unknown -%23 = OpTypeVector %7 4 -%24 = OpTypeSampler -%25 = OpTypeImage %7 2D 1 0 0 1 Unknown -%26 = OpTypeImage %7 2D 1 1 0 1 Unknown -%27 = OpTypeImage %7 Cube 1 0 0 1 Unknown -%28 = OpConstant %14 3 -%29 = OpConstant %14 1 -%30 = OpConstantComposite %13 %28 %29 -%32 = OpTypePointer UniformConstant %3 -%31 = OpVariable %32 UniformConstant -%34 = OpTypePointer UniformConstant %5 -%33 = OpVariable %34 UniformConstant -%36 = OpTypePointer UniformConstant %6 -%35 = OpVariable %36 UniformConstant -%38 = OpTypePointer UniformConstant %8 -%37 = OpVariable %38 UniformConstant -%40 = OpTypePointer UniformConstant %9 -%39 = OpVariable %40 UniformConstant -%42 = OpTypePointer UniformConstant %10 -%41 = OpVariable %42 UniformConstant -%44 = OpTypePointer UniformConstant %11 -%43 = OpVariable %44 UniformConstant -%46 = OpTypePointer UniformConstant %10 -%45 = OpVariable %46 UniformConstant -%48 = OpTypePointer UniformConstant %15 -%47 = OpVariable %48 UniformConstant -%50 = OpTypePointer UniformConstant %16 -%49 = OpVariable %50 UniformConstant -%51 = OpVariable %32 UniformConstant -%53 = OpTypePointer UniformConstant %17 -%52 = OpVariable %53 UniformConstant -%55 = OpTypePointer UniformConstant %18 -%54 = OpVariable %55 UniformConstant -%57 = OpTypePointer UniformConstant %19 -%56 = OpVariable %57 UniformConstant -%59 = OpTypePointer UniformConstant %20 -%58 = OpVariable %59 UniformConstant -%61 = OpTypePointer UniformConstant %21 -%60 = OpVariable %61 UniformConstant -%63 = OpTypePointer UniformConstant %22 -%62 = OpVariable %63 UniformConstant -%65 = OpTypePointer UniformConstant %24 -%64 = OpVariable %65 UniformConstant -%67 = OpTypePointer UniformConstant %24 -%66 = OpVariable %67 UniformConstant -%69 = OpTypePointer UniformConstant %25 -%68 = OpVariable %69 UniformConstant -%71 = OpTypePointer UniformConstant %26 -%70 = OpVariable %71 UniformConstant -%73 = OpTypePointer UniformConstant %27 -%72 = OpVariable %73 UniformConstant -%75 = OpTypeFunction %13 %13 %13 -%80 = OpTypeBool -%79 = OpTypeVector %80 2 -%81 = OpConstant %14 0 -%82 = OpConstantComposite %13 %81 %81 -%84 = OpConstant %14 -2147483648 -%85 = OpConstant %14 -1 -%86 = OpConstantComposite %13 %84 %84 -%87 = OpConstantComposite %13 %85 %85 -%92 = OpConstantComposite %13 %29 %29 -%97 = OpTypePointer Input %12 -%96 = OpVariable %97 Input -%100 = OpTypeFunction %2 -%107 = OpConstant %14 10 -%108 = OpConstant %14 20 -%109 = OpConstantComposite %13 %107 %108 -%111 = OpTypeVector %4 2 -%119 = OpTypeVector %4 4 -%130 = OpTypeVector %14 3 -%188 = OpVariable %97 Input -%209 = OpTypePointer Output %23 -%208 = OpVariable %209 Output -%219 = OpConstant %4 0 -%261 = OpVariable %209 Output -%292 = OpVariable %209 Output -%299 = OpConstant %7 0.5 -%300 = OpTypeVector %7 2 -%301 = OpConstantComposite %300 %299 %299 -%302 = OpTypeVector %7 3 -%303 = OpConstantComposite %302 %299 %299 %299 -%304 = OpConstant %7 2.3 -%305 = OpConstant %7 2.0 -%307 = OpTypePointer Function %23 -%308 = OpConstantNull %23 -%311 = OpTypeSampledImage %15 -%316 = OpTypeSampledImage %16 -%337 = OpTypeSampledImage %18 -%398 = OpTypeSampledImage %20 -%438 = OpTypePointer Output %7 -%437 = OpVariable %438 Output -%445 = OpTypePointer Function %7 -%446 = OpConstantNull %7 -%448 = OpTypeSampledImage %25 -%453 = OpTypeSampledImage %26 -%466 = OpTypeSampledImage %27 -%473 = OpConstant %7 0.0 -%494 = OpVariable %209 Output -%505 = OpConstant %4 1 -%508 = OpConstant %4 3 -%513 = OpTypeSampledImage %3 -%516 = OpTypeVector %14 4 -%517 = OpTypeSampledImage %17 -%528 = OpVariable %209 Output -%74 = OpFunction %13 None %75 -%76 = OpFunctionParameter %13 -%77 = OpFunctionParameter %13 -%78 = OpLabel -%83 = OpIEqual %79 %77 %82 -%88 = OpIEqual %79 %76 %86 -%89 = OpIEqual %79 %77 %87 -%90 = OpLogicalAnd %79 %88 %89 -%91 = OpLogicalOr %79 %83 %90 -%93 = OpSelect %13 %91 %92 %77 -%94 = OpSRem %13 %76 %93 -OpReturnValue %94 +%5 = OpTypeInt 32 0 +%4 = OpTypeImage %5 2D 0 0 0 1 Unknown +%6 = OpTypeImage %5 2D 0 0 1 1 Unknown +%8 = OpTypeFloat 32 +%7 = OpTypeImage %8 2D 1 0 1 1 Unknown +%9 = OpTypeImage %5 2D 0 0 0 2 Rgba8ui +%10 = OpTypeImage %5 2D 0 1 0 1 Unknown +%11 = OpTypeImage %5 1D 0 0 0 2 R32ui +%12 = OpTypeImage %5 1D 0 0 0 1 Unknown +%13 = OpTypeVector %5 3 +%15 = OpTypeInt 32 1 +%14 = OpTypeVector %15 2 +%16 = OpTypeImage %8 1D 0 0 0 1 Unknown +%17 = OpTypeImage %8 2D 0 0 0 1 Unknown +%18 = OpTypeImage %15 2D 0 0 0 1 Unknown +%19 = OpTypeImage %8 2D 0 1 0 1 Unknown +%20 = OpTypeImage %8 Cube 0 0 0 1 Unknown +%21 = OpTypeImage %8 Cube 0 1 0 1 Unknown +%22 = OpTypeImage %8 3D 0 0 0 1 Unknown +%23 = OpTypeImage %8 2D 0 0 1 1 Unknown +%24 = OpTypeVector %8 4 +%25 = OpTypeSampler +%26 = OpTypeImage %8 2D 1 0 0 1 Unknown +%27 = OpTypeImage %8 2D 1 1 0 1 Unknown +%28 = OpTypeImage %8 Cube 1 0 0 1 Unknown +%29 = OpConstant %15 3 +%30 = OpConstant %15 1 +%31 = OpConstantComposite %14 %29 %30 +%33 = OpTypePointer UniformConstant %4 +%32 = OpVariable %33 UniformConstant +%35 = OpTypePointer UniformConstant %6 +%34 = OpVariable %35 UniformConstant +%37 = OpTypePointer UniformConstant %7 +%36 = OpVariable %37 UniformConstant +%39 = OpTypePointer UniformConstant %9 +%38 = OpVariable %39 UniformConstant +%41 = OpTypePointer UniformConstant %10 +%40 = OpVariable %41 UniformConstant +%43 = OpTypePointer UniformConstant %11 +%42 = OpVariable %43 UniformConstant +%45 = OpTypePointer UniformConstant %12 +%44 = OpVariable %45 UniformConstant +%47 = OpTypePointer UniformConstant %11 +%46 = OpVariable %47 UniformConstant +%49 = OpTypePointer UniformConstant %16 +%48 = OpVariable %49 UniformConstant +%51 = OpTypePointer UniformConstant %17 +%50 = OpVariable %51 UniformConstant +%52 = OpVariable %33 UniformConstant +%54 = OpTypePointer UniformConstant %18 +%53 = OpVariable %54 UniformConstant +%56 = OpTypePointer UniformConstant %19 +%55 = OpVariable %56 UniformConstant +%58 = OpTypePointer UniformConstant %20 +%57 = OpVariable %58 UniformConstant +%60 = OpTypePointer UniformConstant %21 +%59 = OpVariable %60 UniformConstant +%62 = OpTypePointer UniformConstant %22 +%61 = OpVariable %62 UniformConstant +%64 = OpTypePointer UniformConstant %23 +%63 = OpVariable %64 UniformConstant +%66 = OpTypePointer UniformConstant %25 +%65 = OpVariable %66 UniformConstant +%68 = OpTypePointer UniformConstant %25 +%67 = OpVariable %68 UniformConstant +%70 = OpTypePointer UniformConstant %26 +%69 = OpVariable %70 UniformConstant +%72 = OpTypePointer UniformConstant %27 +%71 = OpVariable %72 UniformConstant +%74 = OpTypePointer UniformConstant %28 +%73 = OpVariable %74 UniformConstant +%76 = OpTypeFunction %14 %14 %14 +%81 = OpTypeBool +%80 = OpTypeVector %81 2 +%82 = OpConstant %15 0 +%83 = OpConstantComposite %14 %82 %82 +%85 = OpConstant %15 -2147483648 +%86 = OpConstant %15 -1 +%87 = OpConstantComposite %14 %85 %85 +%88 = OpConstantComposite %14 %86 %86 +%93 = OpConstantComposite %14 %30 %30 +%98 = OpTypePointer Input %13 +%97 = OpVariable %98 Input +%101 = OpTypeFunction %2 +%108 = OpConstant %15 10 +%109 = OpConstant %15 20 +%110 = OpConstantComposite %14 %108 %109 +%112 = OpTypeVector %5 2 +%120 = OpTypeVector %5 4 +%131 = OpTypeVector %15 3 +%189 = OpVariable %98 Input +%210 = OpTypePointer Output %24 +%209 = OpVariable %210 Output +%220 = OpConstant %5 0 +%262 = OpVariable %210 Output +%293 = OpVariable %210 Output +%300 = OpConstant %8 0.5 +%301 = OpTypeVector %8 2 +%302 = OpConstantComposite %301 %300 %300 +%303 = OpTypeVector %8 3 +%304 = OpConstantComposite %303 %300 %300 %300 +%305 = OpConstant %8 2.3 +%306 = OpConstant %8 2.0 +%308 = OpTypePointer Function %24 +%309 = OpConstantNull %24 +%312 = OpTypeSampledImage %16 +%317 = OpTypeSampledImage %17 +%338 = OpTypeSampledImage %19 +%399 = OpTypeSampledImage %21 +%439 = OpTypePointer Output %8 +%438 = OpVariable %439 Output +%446 = OpTypePointer Function %8 +%447 = OpConstantNull %8 +%449 = OpTypeSampledImage %26 +%454 = OpTypeSampledImage %27 +%467 = OpTypeSampledImage %28 +%474 = OpConstant %8 0.0 +%495 = OpVariable %210 Output +%506 = OpConstant %5 1 +%509 = OpConstant %5 3 +%514 = OpTypeSampledImage %4 +%517 = OpTypeVector %15 4 +%518 = OpTypeSampledImage %18 +%529 = OpVariable %210 Output +%75 = OpFunction %14 None %76 +%77 = OpFunctionParameter %14 +%78 = OpFunctionParameter %14 +%79 = OpLabel +%84 = OpIEqual %80 %78 %83 +%89 = OpIEqual %80 %77 %87 +%90 = OpIEqual %80 %78 %88 +%91 = OpLogicalAnd %80 %89 %90 +%92 = OpLogicalOr %80 %84 %91 +%94 = OpSelect %14 %92 %93 %78 +%95 = OpSRem %14 %77 %94 +OpReturnValue %95 OpFunctionEnd -%99 = OpFunction %2 None %100 -%95 = OpLabel -%98 = OpLoad %12 %96 -%101 = OpLoad %3 %31 -%102 = OpLoad %5 %33 -%103 = OpLoad %8 %37 -%104 = OpLoad %9 %39 -%105 = OpLoad %11 %43 -%106 = OpLoad %10 %45 -OpBranch %110 -%110 = OpLabel -%112 = OpImageQuerySize %111 %103 -%113 = OpVectorShuffle %111 %98 %98 0 1 -%114 = OpIMul %111 %112 %113 -%115 = OpBitcast %13 %114 -%116 = OpFunctionCall %13 %74 %115 %109 -%117 = OpCompositeExtract %4 %98 2 -%118 = OpBitcast %14 %117 -%120 = OpImageFetch %119 %101 %116 Lod %118 -%121 = OpCompositeExtract %4 %98 2 -%122 = OpBitcast %14 %121 -%123 = OpImageFetch %119 %102 %116 Sample %122 -%124 = OpImageRead %119 %103 %116 -%125 = OpCompositeExtract %4 %98 2 -%126 = OpCompositeExtract %4 %98 2 -%127 = OpBitcast %14 %126 -%128 = OpIAdd %14 %127 %29 -%129 = OpBitcast %14 %125 -%131 = OpCompositeConstruct %130 %116 %129 -%132 = OpImageFetch %119 %104 %131 Lod %128 -%133 = OpCompositeExtract %4 %98 2 -%134 = OpBitcast %14 %133 -%135 = OpCompositeExtract %4 %98 2 -%136 = OpBitcast %14 %135 -%137 = OpIAdd %14 %136 %29 -%138 = OpCompositeConstruct %130 %116 %134 -%139 = OpImageFetch %119 %104 %138 Lod %137 -%140 = OpCompositeExtract %4 %98 0 -%141 = OpBitcast %14 %140 -%142 = OpCompositeExtract %4 %98 2 -%143 = OpBitcast %14 %142 -%144 = OpImageFetch %119 %105 %141 Lod %143 -%145 = OpBitcast %111 %116 -%146 = OpCompositeExtract %4 %98 2 -%147 = OpBitcast %14 %146 -%148 = OpImageFetch %119 %101 %145 Lod %147 -%149 = OpBitcast %111 %116 -%150 = OpCompositeExtract %4 %98 2 -%151 = OpBitcast %14 %150 -%152 = OpImageFetch %119 %102 %149 Sample %151 -%153 = OpBitcast %111 %116 -%154 = OpImageRead %119 %103 %153 -%155 = OpBitcast %111 %116 -%156 = OpCompositeExtract %4 %98 2 -%157 = OpCompositeExtract %4 %98 2 -%158 = OpBitcast %14 %157 -%159 = OpIAdd %14 %158 %29 -%160 = OpCompositeConstruct %12 %155 %156 -%161 = OpImageFetch %119 %104 %160 Lod %159 -%162 = OpBitcast %111 %116 -%163 = OpCompositeExtract %4 %98 2 -%164 = OpBitcast %14 %163 -%165 = OpCompositeExtract %4 %98 2 -%166 = OpBitcast %14 %165 -%167 = OpIAdd %14 %166 %29 -%168 = OpBitcast %4 %164 -%169 = OpCompositeConstruct %12 %162 %168 -%170 = OpImageFetch %119 %104 %169 Lod %167 -%171 = OpCompositeExtract %4 %98 0 -%173 = OpCompositeExtract %4 %98 2 -%174 = OpBitcast %14 %173 -%175 = OpImageFetch %119 %105 %171 Lod %174 -%176 = OpCompositeExtract %14 %116 0 -%177 = OpIAdd %119 %120 %123 -%178 = OpIAdd %119 %177 %124 -%179 = OpIAdd %119 %178 %132 -%180 = OpIAdd %119 %179 %139 -OpImageWrite %106 %176 %180 -%181 = OpCompositeExtract %14 %116 0 -%182 = OpBitcast %4 %181 -%183 = OpIAdd %119 %148 %152 -%184 = OpIAdd %119 %183 %154 -%185 = OpIAdd %119 %184 %161 -%186 = OpIAdd %119 %185 %170 -OpImageWrite %106 %182 %186 +%100 = OpFunction %2 None %101 +%96 = OpLabel +%99 = OpLoad %13 %97 +%102 = OpLoad %4 %32 +%103 = OpLoad %6 %34 +%104 = OpLoad %9 %38 +%105 = OpLoad %10 %40 +%106 = OpLoad %12 %44 +%107 = OpLoad %11 %46 +OpBranch %111 +%111 = OpLabel +OpLine %3 20 15 +%113 = OpImageQuerySize %112 %104 +OpLine %3 21 15 +%114 = OpVectorShuffle %112 %99 %99 0 1 +%115 = OpIMul %112 %113 %114 +%116 = OpBitcast %14 %115 +OpLine %3 21 15 +%117 = OpFunctionCall %14 %75 %116 %110 +OpLine %3 23 18 +%118 = OpCompositeExtract %5 %99 2 +%119 = OpBitcast %15 %118 +%121 = OpImageFetch %120 %102 %117 Lod %119 +OpLine %3 24 18 +%122 = OpCompositeExtract %5 %99 2 +%123 = OpBitcast %15 %122 +%124 = OpImageFetch %120 %103 %117 Sample %123 +OpLine %3 25 18 +%125 = OpImageRead %120 %104 %117 +OpLine %3 26 52 +%126 = OpCompositeExtract %5 %99 2 +%127 = OpCompositeExtract %5 %99 2 +%128 = OpBitcast %15 %127 +OpLine %3 26 18 +%129 = OpIAdd %15 %128 %30 +%130 = OpBitcast %15 %126 +%132 = OpCompositeConstruct %131 %117 %130 +%133 = OpImageFetch %120 %105 %132 Lod %129 +OpLine %3 27 52 +%134 = OpCompositeExtract %5 %99 2 +%135 = OpBitcast %15 %134 +%136 = OpCompositeExtract %5 %99 2 +%137 = OpBitcast %15 %136 +OpLine %3 27 18 +%138 = OpIAdd %15 %137 %30 +%139 = OpCompositeConstruct %131 %117 %135 +%140 = OpImageFetch %120 %105 %139 Lod %138 +OpLine %3 28 18 +%141 = OpCompositeExtract %5 %99 0 +%142 = OpBitcast %15 %141 +%143 = OpCompositeExtract %5 %99 2 +%144 = OpBitcast %15 %143 +%145 = OpImageFetch %120 %106 %142 Lod %144 +OpLine %3 30 19 +%146 = OpBitcast %112 %117 +%147 = OpCompositeExtract %5 %99 2 +%148 = OpBitcast %15 %147 +%149 = OpImageFetch %120 %102 %146 Lod %148 +OpLine %3 31 19 +%150 = OpBitcast %112 %117 +%151 = OpCompositeExtract %5 %99 2 +%152 = OpBitcast %15 %151 +%153 = OpImageFetch %120 %103 %150 Sample %152 +OpLine %3 32 19 +%154 = OpBitcast %112 %117 +%155 = OpImageRead %120 %104 %154 +OpLine %3 33 48 +%156 = OpBitcast %112 %117 +%157 = OpCompositeExtract %5 %99 2 +%158 = OpCompositeExtract %5 %99 2 +%159 = OpBitcast %15 %158 +OpLine %3 33 19 +%160 = OpIAdd %15 %159 %30 +%161 = OpCompositeConstruct %13 %156 %157 +%162 = OpImageFetch %120 %105 %161 Lod %160 +OpLine %3 34 48 +%163 = OpBitcast %112 %117 +%164 = OpCompositeExtract %5 %99 2 +%165 = OpBitcast %15 %164 +%166 = OpCompositeExtract %5 %99 2 +%167 = OpBitcast %15 %166 +OpLine %3 34 19 +%168 = OpIAdd %15 %167 %30 +%169 = OpBitcast %5 %165 +%170 = OpCompositeConstruct %13 %163 %169 +%171 = OpImageFetch %120 %105 %170 Lod %168 +OpLine %3 35 19 +%172 = OpCompositeExtract %5 %99 0 +%174 = OpCompositeExtract %5 %99 2 +%175 = OpBitcast %15 %174 +%176 = OpImageFetch %120 %106 %172 Lod %175 +OpLine %3 37 29 +%177 = OpCompositeExtract %15 %117 0 +%178 = OpIAdd %120 %121 %124 +%179 = OpIAdd %120 %178 %125 +%180 = OpIAdd %120 %179 %133 +%181 = OpIAdd %120 %180 %140 +OpLine %3 37 5 +OpImageWrite %107 %177 %181 +OpLine %3 39 29 +%182 = OpCompositeExtract %15 %117 0 +%183 = OpBitcast %5 %182 +%184 = OpIAdd %120 %149 %153 +%185 = OpIAdd %120 %184 %155 +%186 = OpIAdd %120 %185 %162 +%187 = OpIAdd %120 %186 %171 +OpLine %3 39 5 +OpImageWrite %107 %183 %187 OpReturn OpFunctionEnd -%190 = OpFunction %2 None %100 -%187 = OpLabel -%189 = OpLoad %12 %188 -%191 = OpLoad %6 %35 -%192 = OpLoad %8 %37 -%193 = OpLoad %10 %45 -OpBranch %194 -%194 = OpLabel -%195 = OpImageQuerySize %111 %192 -%196 = OpVectorShuffle %111 %189 %189 0 1 -%197 = OpIMul %111 %195 %196 -%198 = OpBitcast %13 %197 -%199 = OpFunctionCall %13 %74 %198 %109 -%200 = OpCompositeExtract %4 %189 2 -%201 = OpBitcast %14 %200 -%202 = OpImageFetch %23 %191 %199 Sample %201 -%203 = OpCompositeExtract %7 %202 0 -%204 = OpCompositeExtract %14 %199 0 -%205 = OpConvertFToU %4 %203 -%206 = OpCompositeConstruct %119 %205 %205 %205 %205 -OpImageWrite %193 %204 %206 +%191 = OpFunction %2 None %101 +%188 = OpLabel +%190 = OpLoad %13 %189 +%192 = OpLoad %7 %36 +%193 = OpLoad %9 %38 +%194 = OpLoad %11 %46 +OpBranch %195 +%195 = OpLabel +OpLine %3 44 26 +%196 = OpImageQuerySize %112 %193 +OpLine %3 45 27 +%197 = OpVectorShuffle %112 %190 %190 0 1 +%198 = OpIMul %112 %196 %197 +%199 = OpBitcast %14 %198 +OpLine %3 45 27 +%200 = OpFunctionCall %14 %75 %199 %110 +OpLine %3 46 20 +%201 = OpCompositeExtract %5 %190 2 +%202 = OpBitcast %15 %201 +%203 = OpImageFetch %24 %192 %200 Sample %202 +%204 = OpCompositeExtract %8 %203 0 +OpLine %3 47 29 +%205 = OpCompositeExtract %15 %200 0 +%206 = OpConvertFToU %5 %204 +%207 = OpCompositeConstruct %120 %206 %206 %206 %206 +OpLine %3 47 5 +OpImageWrite %194 %205 %207 OpReturn OpFunctionEnd -%210 = OpFunction %2 None %100 -%207 = OpLabel -%211 = OpLoad %15 %47 -%212 = OpLoad %16 %49 -%213 = OpLoad %18 %54 -%214 = OpLoad %19 %56 -%215 = OpLoad %20 %58 -%216 = OpLoad %21 %60 -%217 = OpLoad %22 %62 -OpBranch %218 -%218 = OpLabel -%220 = OpImageQuerySizeLod %4 %211 %219 -%221 = OpBitcast %14 %220 -%222 = OpImageQuerySizeLod %4 %211 %221 -%223 = OpImageQuerySizeLod %111 %212 %219 -%224 = OpImageQuerySizeLod %111 %212 %29 -%225 = OpImageQuerySizeLod %12 %213 %219 -%226 = OpVectorShuffle %111 %225 %225 0 1 -%227 = OpImageQuerySizeLod %12 %213 %29 -%228 = OpVectorShuffle %111 %227 %227 0 1 -%229 = OpImageQuerySizeLod %111 %214 %219 -%230 = OpImageQuerySizeLod %111 %214 %29 -%231 = OpImageQuerySizeLod %12 %215 %219 -%232 = OpVectorShuffle %111 %231 %231 0 0 -%233 = OpImageQuerySizeLod %12 %215 %29 -%234 = OpVectorShuffle %111 %233 %233 0 0 -%235 = OpImageQuerySizeLod %12 %216 %219 -%236 = OpImageQuerySizeLod %12 %216 %29 -%237 = OpImageQuerySize %111 %217 -%238 = OpCompositeExtract %4 %223 1 -%239 = OpIAdd %4 %220 %238 -%240 = OpCompositeExtract %4 %224 1 -%241 = OpIAdd %4 %239 %240 -%242 = OpCompositeExtract %4 %226 1 -%243 = OpIAdd %4 %241 %242 -%244 = OpCompositeExtract %4 %228 1 -%245 = OpIAdd %4 %243 %244 -%246 = OpCompositeExtract %4 %229 1 -%247 = OpIAdd %4 %245 %246 -%248 = OpCompositeExtract %4 %230 1 -%249 = OpIAdd %4 %247 %248 -%250 = OpCompositeExtract %4 %232 1 -%251 = OpIAdd %4 %249 %250 -%252 = OpCompositeExtract %4 %234 1 -%253 = OpIAdd %4 %251 %252 -%254 = OpCompositeExtract %4 %235 2 -%255 = OpIAdd %4 %253 %254 -%256 = OpCompositeExtract %4 %236 2 -%257 = OpIAdd %4 %255 %256 -%258 = OpConvertUToF %7 %257 -%259 = OpCompositeConstruct %23 %258 %258 %258 %258 -OpStore %208 %259 +%211 = OpFunction %2 None %101 +%208 = OpLabel +%212 = OpLoad %16 %48 +%213 = OpLoad %17 %50 +%214 = OpLoad %19 %55 +%215 = OpLoad %20 %57 +%216 = OpLoad %21 %59 +%217 = OpLoad %22 %61 +%218 = OpLoad %23 %63 +OpBranch %219 +%219 = OpLabel +OpLine %3 72 18 +%221 = OpImageQuerySizeLod %5 %212 %220 +OpLine %3 73 22 +%222 = OpBitcast %15 %221 +%223 = OpImageQuerySizeLod %5 %212 %222 +OpLine %3 74 18 +%224 = OpImageQuerySizeLod %112 %213 %220 +OpLine %3 75 22 +%225 = OpImageQuerySizeLod %112 %213 %30 +OpLine %3 76 24 +%226 = OpImageQuerySizeLod %13 %214 %220 +%227 = OpVectorShuffle %112 %226 %226 0 1 +OpLine %3 77 28 +%228 = OpImageQuerySizeLod %13 %214 %30 +%229 = OpVectorShuffle %112 %228 %228 0 1 +OpLine %3 78 20 +%230 = OpImageQuerySizeLod %112 %215 %220 +OpLine %3 79 24 +%231 = OpImageQuerySizeLod %112 %215 %30 +OpLine %3 80 26 +%232 = OpImageQuerySizeLod %13 %216 %220 +%233 = OpVectorShuffle %112 %232 %232 0 0 +OpLine %3 81 30 +%234 = OpImageQuerySizeLod %13 %216 %30 +%235 = OpVectorShuffle %112 %234 %234 0 0 +OpLine %3 82 18 +%236 = OpImageQuerySizeLod %13 %217 %220 +OpLine %3 83 22 +%237 = OpImageQuerySizeLod %13 %217 %30 +OpLine %3 84 21 +%238 = OpImageQuerySize %112 %218 +OpLine %3 86 15 +%239 = OpCompositeExtract %5 %224 1 +%240 = OpIAdd %5 %221 %239 +%241 = OpCompositeExtract %5 %225 1 +%242 = OpIAdd %5 %240 %241 +%243 = OpCompositeExtract %5 %227 1 +%244 = OpIAdd %5 %242 %243 +%245 = OpCompositeExtract %5 %229 1 +%246 = OpIAdd %5 %244 %245 +%247 = OpCompositeExtract %5 %230 1 +%248 = OpIAdd %5 %246 %247 +%249 = OpCompositeExtract %5 %231 1 +%250 = OpIAdd %5 %248 %249 +%251 = OpCompositeExtract %5 %233 1 +%252 = OpIAdd %5 %250 %251 +%253 = OpCompositeExtract %5 %235 1 +%254 = OpIAdd %5 %252 %253 +%255 = OpCompositeExtract %5 %236 2 +%256 = OpIAdd %5 %254 %255 +%257 = OpCompositeExtract %5 %237 2 +%258 = OpIAdd %5 %256 %257 +OpLine %3 89 12 +%259 = OpConvertUToF %8 %258 +%260 = OpCompositeConstruct %24 %259 %259 %259 %259 +OpStore %209 %260 OpReturn OpFunctionEnd -%262 = OpFunction %2 None %100 -%260 = OpLabel -%263 = OpLoad %16 %49 -%264 = OpLoad %18 %54 -%265 = OpLoad %19 %56 -%266 = OpLoad %20 %58 -%267 = OpLoad %21 %60 -%268 = OpLoad %22 %62 -OpBranch %269 -%269 = OpLabel -%270 = OpImageQueryLevels %4 %263 -%271 = OpImageQuerySizeLod %12 %264 %219 -%272 = OpCompositeExtract %4 %271 2 -%273 = OpImageQueryLevels %4 %264 -%274 = OpImageQuerySizeLod %12 %264 %219 -%275 = OpCompositeExtract %4 %274 2 -%276 = OpImageQueryLevels %4 %265 -%277 = OpImageQueryLevels %4 %266 -%278 = OpImageQuerySizeLod %12 %266 %219 -%279 = OpCompositeExtract %4 %278 2 -%280 = OpImageQueryLevels %4 %267 -%281 = OpImageQuerySamples %4 %268 -%282 = OpIAdd %4 %272 %279 -%283 = OpIAdd %4 %282 %281 -%284 = OpIAdd %4 %283 %270 -%285 = OpIAdd %4 %284 %273 -%286 = OpIAdd %4 %285 %280 -%287 = OpIAdd %4 %286 %276 -%288 = OpIAdd %4 %287 %277 -%289 = OpConvertUToF %7 %288 -%290 = OpCompositeConstruct %23 %289 %289 %289 %289 -OpStore %261 %290 +%263 = OpFunction %2 None %101 +%261 = OpLabel +%264 = OpLoad %17 %50 +%265 = OpLoad %19 %55 +%266 = OpLoad %20 %57 +%267 = OpLoad %21 %59 +%268 = OpLoad %22 %61 +%269 = OpLoad %23 %63 +OpBranch %270 +%270 = OpLabel +OpLine %3 94 25 +%271 = OpImageQueryLevels %5 %264 +OpLine %3 95 25 +%272 = OpImageQuerySizeLod %13 %265 %220 +%273 = OpCompositeExtract %5 %272 2 +OpLine %3 96 31 +%274 = OpImageQueryLevels %5 %265 +OpLine %3 97 31 +%275 = OpImageQuerySizeLod %13 %265 %220 +%276 = OpCompositeExtract %5 %275 2 +OpLine %3 98 27 +%277 = OpImageQueryLevels %5 %266 +OpLine %3 99 33 +%278 = OpImageQueryLevels %5 %267 +OpLine %3 100 27 +%279 = OpImageQuerySizeLod %13 %267 %220 +%280 = OpCompositeExtract %5 %279 2 +OpLine %3 101 25 +%281 = OpImageQueryLevels %5 %268 +OpLine %3 102 26 +%282 = OpImageQuerySamples %5 %269 +OpLine %3 104 15 +%283 = OpIAdd %5 %273 %280 +%284 = OpIAdd %5 %283 %282 +%285 = OpIAdd %5 %284 %271 +%286 = OpIAdd %5 %285 %274 +%287 = OpIAdd %5 %286 %281 +%288 = OpIAdd %5 %287 %277 +%289 = OpIAdd %5 %288 %278 +OpLine %3 106 12 +%290 = OpConvertUToF %8 %289 +%291 = OpCompositeConstruct %24 %290 %290 %290 %290 +OpStore %262 %291 OpReturn OpFunctionEnd -%293 = OpFunction %2 None %100 -%291 = OpLabel -%306 = OpVariable %307 Function %308 -%294 = OpLoad %15 %47 -%295 = OpLoad %16 %49 -%296 = OpLoad %18 %54 -%297 = OpLoad %20 %58 -%298 = OpLoad %24 %64 -OpBranch %309 -%309 = OpLabel -%310 = OpCompositeExtract %7 %301 0 -%312 = OpSampledImage %311 %294 %298 -%313 = OpImageSampleImplicitLod %23 %312 %310 -%314 = OpLoad %23 %306 -%315 = OpFAdd %23 %314 %313 -OpStore %306 %315 -%317 = OpSampledImage %316 %295 %298 -%318 = OpImageSampleImplicitLod %23 %317 %301 -%319 = OpLoad %23 %306 -%320 = OpFAdd %23 %319 %318 -OpStore %306 %320 -%321 = OpSampledImage %316 %295 %298 -%322 = OpImageSampleImplicitLod %23 %321 %301 ConstOffset %30 -%323 = OpLoad %23 %306 -%324 = OpFAdd %23 %323 %322 -OpStore %306 %324 -%325 = OpSampledImage %316 %295 %298 -%326 = OpImageSampleExplicitLod %23 %325 %301 Lod %304 -%327 = OpLoad %23 %306 -%328 = OpFAdd %23 %327 %326 -OpStore %306 %328 -%329 = OpSampledImage %316 %295 %298 -%330 = OpImageSampleExplicitLod %23 %329 %301 Lod|ConstOffset %304 %30 -%331 = OpLoad %23 %306 -%332 = OpFAdd %23 %331 %330 -OpStore %306 %332 -%333 = OpSampledImage %316 %295 %298 -%334 = OpImageSampleImplicitLod %23 %333 %301 Bias|ConstOffset %305 %30 -%335 = OpLoad %23 %306 -%336 = OpFAdd %23 %335 %334 -OpStore %306 %336 -%338 = OpConvertUToF %7 %219 -%339 = OpCompositeConstruct %302 %301 %338 -%340 = OpSampledImage %337 %296 %298 -%341 = OpImageSampleImplicitLod %23 %340 %339 -%342 = OpLoad %23 %306 -%343 = OpFAdd %23 %342 %341 -OpStore %306 %343 -%344 = OpConvertUToF %7 %219 -%345 = OpCompositeConstruct %302 %301 %344 -%346 = OpSampledImage %337 %296 %298 -%347 = OpImageSampleImplicitLod %23 %346 %345 ConstOffset %30 -%348 = OpLoad %23 %306 -%349 = OpFAdd %23 %348 %347 -OpStore %306 %349 -%350 = OpConvertUToF %7 %219 -%351 = OpCompositeConstruct %302 %301 %350 -%352 = OpSampledImage %337 %296 %298 -%353 = OpImageSampleExplicitLod %23 %352 %351 Lod %304 -%354 = OpLoad %23 %306 -%355 = OpFAdd %23 %354 %353 -OpStore %306 %355 -%356 = OpConvertUToF %7 %219 -%357 = OpCompositeConstruct %302 %301 %356 -%358 = OpSampledImage %337 %296 %298 -%359 = OpImageSampleExplicitLod %23 %358 %357 Lod|ConstOffset %304 %30 -%360 = OpLoad %23 %306 -%361 = OpFAdd %23 %360 %359 -OpStore %306 %361 -%362 = OpConvertUToF %7 %219 -%363 = OpCompositeConstruct %302 %301 %362 -%364 = OpSampledImage %337 %296 %298 -%365 = OpImageSampleImplicitLod %23 %364 %363 Bias|ConstOffset %305 %30 -%366 = OpLoad %23 %306 -%367 = OpFAdd %23 %366 %365 -OpStore %306 %367 -%368 = OpConvertSToF %7 %81 -%369 = OpCompositeConstruct %302 %301 %368 -%370 = OpSampledImage %337 %296 %298 -%371 = OpImageSampleImplicitLod %23 %370 %369 -%372 = OpLoad %23 %306 -%373 = OpFAdd %23 %372 %371 -OpStore %306 %373 -%374 = OpConvertSToF %7 %81 -%375 = OpCompositeConstruct %302 %301 %374 -%376 = OpSampledImage %337 %296 %298 -%377 = OpImageSampleImplicitLod %23 %376 %375 ConstOffset %30 -%378 = OpLoad %23 %306 -%379 = OpFAdd %23 %378 %377 -OpStore %306 %379 -%380 = OpConvertSToF %7 %81 -%381 = OpCompositeConstruct %302 %301 %380 -%382 = OpSampledImage %337 %296 %298 -%383 = OpImageSampleExplicitLod %23 %382 %381 Lod %304 -%384 = OpLoad %23 %306 -%385 = OpFAdd %23 %384 %383 -OpStore %306 %385 -%386 = OpConvertSToF %7 %81 -%387 = OpCompositeConstruct %302 %301 %386 -%388 = OpSampledImage %337 %296 %298 -%389 = OpImageSampleExplicitLod %23 %388 %387 Lod|ConstOffset %304 %30 -%390 = OpLoad %23 %306 -%391 = OpFAdd %23 %390 %389 -OpStore %306 %391 -%392 = OpConvertSToF %7 %81 -%393 = OpCompositeConstruct %302 %301 %392 -%394 = OpSampledImage %337 %296 %298 -%395 = OpImageSampleImplicitLod %23 %394 %393 Bias|ConstOffset %305 %30 -%396 = OpLoad %23 %306 -%397 = OpFAdd %23 %396 %395 -OpStore %306 %397 -%399 = OpConvertUToF %7 %219 -%400 = OpCompositeConstruct %23 %303 %399 -%401 = OpSampledImage %398 %297 %298 -%402 = OpImageSampleImplicitLod %23 %401 %400 -%403 = OpLoad %23 %306 -%404 = OpFAdd %23 %403 %402 -OpStore %306 %404 -%405 = OpConvertUToF %7 %219 -%406 = OpCompositeConstruct %23 %303 %405 -%407 = OpSampledImage %398 %297 %298 -%408 = OpImageSampleExplicitLod %23 %407 %406 Lod %304 -%409 = OpLoad %23 %306 -%410 = OpFAdd %23 %409 %408 -OpStore %306 %410 -%411 = OpConvertUToF %7 %219 -%412 = OpCompositeConstruct %23 %303 %411 -%413 = OpSampledImage %398 %297 %298 -%414 = OpImageSampleImplicitLod %23 %413 %412 Bias %305 -%415 = OpLoad %23 %306 -%416 = OpFAdd %23 %415 %414 -OpStore %306 %416 -%417 = OpConvertSToF %7 %81 -%418 = OpCompositeConstruct %23 %303 %417 -%419 = OpSampledImage %398 %297 %298 -%420 = OpImageSampleImplicitLod %23 %419 %418 -%421 = OpLoad %23 %306 -%422 = OpFAdd %23 %421 %420 -OpStore %306 %422 -%423 = OpConvertSToF %7 %81 -%424 = OpCompositeConstruct %23 %303 %423 -%425 = OpSampledImage %398 %297 %298 -%426 = OpImageSampleExplicitLod %23 %425 %424 Lod %304 -%427 = OpLoad %23 %306 -%428 = OpFAdd %23 %427 %426 -OpStore %306 %428 -%429 = OpConvertSToF %7 %81 -%430 = OpCompositeConstruct %23 %303 %429 -%431 = OpSampledImage %398 %297 %298 -%432 = OpImageSampleImplicitLod %23 %431 %430 Bias %305 -%433 = OpLoad %23 %306 -%434 = OpFAdd %23 %433 %432 -OpStore %306 %434 -%435 = OpLoad %23 %306 -OpStore %292 %435 +%294 = OpFunction %2 None %101 +%292 = OpLabel +%307 = OpVariable %308 Function %309 +%295 = OpLoad %16 %48 +%296 = OpLoad %17 %50 +%297 = OpLoad %19 %55 +%298 = OpLoad %21 %59 +%299 = OpLoad %25 %65 +OpBranch %310 +%310 = OpLabel +OpLine %3 114 14 +OpLine %3 115 15 +OpLine %3 118 5 +%311 = OpCompositeExtract %8 %302 0 +%313 = OpSampledImage %312 %295 %299 +%314 = OpImageSampleImplicitLod %24 %313 %311 +%315 = OpLoad %24 %307 +%316 = OpFAdd %24 %315 %314 +OpLine %3 118 5 +OpStore %307 %316 +OpLine %3 119 5 +%318 = OpSampledImage %317 %296 %299 +%319 = OpImageSampleImplicitLod %24 %318 %302 +%320 = OpLoad %24 %307 +%321 = OpFAdd %24 %320 %319 +OpLine %3 119 5 +OpStore %307 %321 +OpLine %3 120 5 +%322 = OpSampledImage %317 %296 %299 +%323 = OpImageSampleImplicitLod %24 %322 %302 ConstOffset %31 +%324 = OpLoad %24 %307 +%325 = OpFAdd %24 %324 %323 +OpLine %3 120 5 +OpStore %307 %325 +OpLine %3 121 5 +%326 = OpSampledImage %317 %296 %299 +%327 = OpImageSampleExplicitLod %24 %326 %302 Lod %305 +%328 = OpLoad %24 %307 +%329 = OpFAdd %24 %328 %327 +OpLine %3 121 5 +OpStore %307 %329 +OpLine %3 122 5 +%330 = OpSampledImage %317 %296 %299 +%331 = OpImageSampleExplicitLod %24 %330 %302 Lod|ConstOffset %305 %31 +%332 = OpLoad %24 %307 +%333 = OpFAdd %24 %332 %331 +OpLine %3 122 5 +OpStore %307 %333 +OpLine %3 123 5 +%334 = OpSampledImage %317 %296 %299 +%335 = OpImageSampleImplicitLod %24 %334 %302 Bias|ConstOffset %306 %31 +%336 = OpLoad %24 %307 +%337 = OpFAdd %24 %336 %335 +OpLine %3 123 5 +OpStore %307 %337 +OpLine %3 124 5 +%339 = OpConvertUToF %8 %220 +%340 = OpCompositeConstruct %303 %302 %339 +%341 = OpSampledImage %338 %297 %299 +%342 = OpImageSampleImplicitLod %24 %341 %340 +%343 = OpLoad %24 %307 +%344 = OpFAdd %24 %343 %342 +OpLine %3 124 5 +OpStore %307 %344 +OpLine %3 125 5 +%345 = OpConvertUToF %8 %220 +%346 = OpCompositeConstruct %303 %302 %345 +%347 = OpSampledImage %338 %297 %299 +%348 = OpImageSampleImplicitLod %24 %347 %346 ConstOffset %31 +%349 = OpLoad %24 %307 +%350 = OpFAdd %24 %349 %348 +OpLine %3 125 5 +OpStore %307 %350 +OpLine %3 126 5 +%351 = OpConvertUToF %8 %220 +%352 = OpCompositeConstruct %303 %302 %351 +%353 = OpSampledImage %338 %297 %299 +%354 = OpImageSampleExplicitLod %24 %353 %352 Lod %305 +%355 = OpLoad %24 %307 +%356 = OpFAdd %24 %355 %354 +OpLine %3 126 5 +OpStore %307 %356 +OpLine %3 127 5 +%357 = OpConvertUToF %8 %220 +%358 = OpCompositeConstruct %303 %302 %357 +%359 = OpSampledImage %338 %297 %299 +%360 = OpImageSampleExplicitLod %24 %359 %358 Lod|ConstOffset %305 %31 +%361 = OpLoad %24 %307 +%362 = OpFAdd %24 %361 %360 +OpLine %3 127 5 +OpStore %307 %362 +OpLine %3 128 5 +%363 = OpConvertUToF %8 %220 +%364 = OpCompositeConstruct %303 %302 %363 +%365 = OpSampledImage %338 %297 %299 +%366 = OpImageSampleImplicitLod %24 %365 %364 Bias|ConstOffset %306 %31 +%367 = OpLoad %24 %307 +%368 = OpFAdd %24 %367 %366 +OpLine %3 128 5 +OpStore %307 %368 +OpLine %3 129 5 +%369 = OpConvertSToF %8 %82 +%370 = OpCompositeConstruct %303 %302 %369 +%371 = OpSampledImage %338 %297 %299 +%372 = OpImageSampleImplicitLod %24 %371 %370 +%373 = OpLoad %24 %307 +%374 = OpFAdd %24 %373 %372 +OpLine %3 129 5 +OpStore %307 %374 +OpLine %3 130 5 +%375 = OpConvertSToF %8 %82 +%376 = OpCompositeConstruct %303 %302 %375 +%377 = OpSampledImage %338 %297 %299 +%378 = OpImageSampleImplicitLod %24 %377 %376 ConstOffset %31 +%379 = OpLoad %24 %307 +%380 = OpFAdd %24 %379 %378 +OpLine %3 130 5 +OpStore %307 %380 +OpLine %3 131 5 +%381 = OpConvertSToF %8 %82 +%382 = OpCompositeConstruct %303 %302 %381 +%383 = OpSampledImage %338 %297 %299 +%384 = OpImageSampleExplicitLod %24 %383 %382 Lod %305 +%385 = OpLoad %24 %307 +%386 = OpFAdd %24 %385 %384 +OpLine %3 131 5 +OpStore %307 %386 +OpLine %3 132 5 +%387 = OpConvertSToF %8 %82 +%388 = OpCompositeConstruct %303 %302 %387 +%389 = OpSampledImage %338 %297 %299 +%390 = OpImageSampleExplicitLod %24 %389 %388 Lod|ConstOffset %305 %31 +%391 = OpLoad %24 %307 +%392 = OpFAdd %24 %391 %390 +OpLine %3 132 5 +OpStore %307 %392 +OpLine %3 133 5 +%393 = OpConvertSToF %8 %82 +%394 = OpCompositeConstruct %303 %302 %393 +%395 = OpSampledImage %338 %297 %299 +%396 = OpImageSampleImplicitLod %24 %395 %394 Bias|ConstOffset %306 %31 +%397 = OpLoad %24 %307 +%398 = OpFAdd %24 %397 %396 +OpLine %3 133 5 +OpStore %307 %398 +OpLine %3 134 5 +%400 = OpConvertUToF %8 %220 +%401 = OpCompositeConstruct %24 %304 %400 +%402 = OpSampledImage %399 %298 %299 +%403 = OpImageSampleImplicitLod %24 %402 %401 +%404 = OpLoad %24 %307 +%405 = OpFAdd %24 %404 %403 +OpLine %3 134 5 +OpStore %307 %405 +OpLine %3 135 5 +%406 = OpConvertUToF %8 %220 +%407 = OpCompositeConstruct %24 %304 %406 +%408 = OpSampledImage %399 %298 %299 +%409 = OpImageSampleExplicitLod %24 %408 %407 Lod %305 +%410 = OpLoad %24 %307 +%411 = OpFAdd %24 %410 %409 +OpLine %3 135 5 +OpStore %307 %411 +OpLine %3 136 5 +%412 = OpConvertUToF %8 %220 +%413 = OpCompositeConstruct %24 %304 %412 +%414 = OpSampledImage %399 %298 %299 +%415 = OpImageSampleImplicitLod %24 %414 %413 Bias %306 +%416 = OpLoad %24 %307 +%417 = OpFAdd %24 %416 %415 +OpLine %3 136 5 +OpStore %307 %417 +OpLine %3 137 5 +%418 = OpConvertSToF %8 %82 +%419 = OpCompositeConstruct %24 %304 %418 +%420 = OpSampledImage %399 %298 %299 +%421 = OpImageSampleImplicitLod %24 %420 %419 +%422 = OpLoad %24 %307 +%423 = OpFAdd %24 %422 %421 +OpLine %3 137 5 +OpStore %307 %423 +OpLine %3 138 5 +%424 = OpConvertSToF %8 %82 +%425 = OpCompositeConstruct %24 %304 %424 +%426 = OpSampledImage %399 %298 %299 +%427 = OpImageSampleExplicitLod %24 %426 %425 Lod %305 +%428 = OpLoad %24 %307 +%429 = OpFAdd %24 %428 %427 +OpLine %3 138 5 +OpStore %307 %429 +OpLine %3 139 5 +%430 = OpConvertSToF %8 %82 +%431 = OpCompositeConstruct %24 %304 %430 +%432 = OpSampledImage %399 %298 %299 +%433 = OpImageSampleImplicitLod %24 %432 %431 Bias %306 +%434 = OpLoad %24 %307 +%435 = OpFAdd %24 %434 %433 +OpLine %3 139 5 +OpStore %307 %435 +OpLine %3 1 1 +%436 = OpLoad %24 %307 +OpStore %293 %436 OpReturn OpFunctionEnd -%439 = OpFunction %2 None %100 -%436 = OpLabel -%444 = OpVariable %445 Function %446 -%440 = OpLoad %24 %66 -%441 = OpLoad %25 %68 -%442 = OpLoad %26 %70 -%443 = OpLoad %27 %72 -OpBranch %447 -%447 = OpLabel -%449 = OpSampledImage %448 %441 %440 -%450 = OpImageSampleDrefImplicitLod %7 %449 %301 %299 -%451 = OpLoad %7 %444 -%452 = OpFAdd %7 %451 %450 -OpStore %444 %452 -%454 = OpConvertUToF %7 %219 -%455 = OpCompositeConstruct %302 %301 %454 -%456 = OpSampledImage %453 %442 %440 -%457 = OpImageSampleDrefImplicitLod %7 %456 %455 %299 -%458 = OpLoad %7 %444 -%459 = OpFAdd %7 %458 %457 -OpStore %444 %459 -%460 = OpConvertSToF %7 %81 -%461 = OpCompositeConstruct %302 %301 %460 -%462 = OpSampledImage %453 %442 %440 -%463 = OpImageSampleDrefImplicitLod %7 %462 %461 %299 -%464 = OpLoad %7 %444 -%465 = OpFAdd %7 %464 %463 -OpStore %444 %465 -%467 = OpSampledImage %466 %443 %440 -%468 = OpImageSampleDrefImplicitLod %7 %467 %303 %299 -%469 = OpLoad %7 %444 -%470 = OpFAdd %7 %469 %468 -OpStore %444 %470 -%471 = OpSampledImage %448 %441 %440 -%472 = OpImageSampleDrefExplicitLod %7 %471 %301 %299 Lod %473 -%474 = OpLoad %7 %444 -%475 = OpFAdd %7 %474 %472 -OpStore %444 %475 -%476 = OpConvertUToF %7 %219 -%477 = OpCompositeConstruct %302 %301 %476 -%478 = OpSampledImage %453 %442 %440 -%479 = OpImageSampleDrefExplicitLod %7 %478 %477 %299 Lod %473 -%480 = OpLoad %7 %444 -%481 = OpFAdd %7 %480 %479 -OpStore %444 %481 -%482 = OpConvertSToF %7 %81 -%483 = OpCompositeConstruct %302 %301 %482 -%484 = OpSampledImage %453 %442 %440 -%485 = OpImageSampleDrefExplicitLod %7 %484 %483 %299 Lod %473 -%486 = OpLoad %7 %444 -%487 = OpFAdd %7 %486 %485 -OpStore %444 %487 -%488 = OpSampledImage %466 %443 %440 -%489 = OpImageSampleDrefExplicitLod %7 %488 %303 %299 Lod %473 -%490 = OpLoad %7 %444 -%491 = OpFAdd %7 %490 %489 -OpStore %444 %491 -%492 = OpLoad %7 %444 -OpStore %437 %492 +%440 = OpFunction %2 None %101 +%437 = OpLabel +%445 = OpVariable %446 Function %447 +%441 = OpLoad %25 %67 +%442 = OpLoad %26 %69 +%443 = OpLoad %27 %71 +%444 = OpLoad %28 %73 +OpBranch %448 +%448 = OpLabel +OpLine %3 154 14 +OpLine %3 155 15 +OpLine %3 158 5 +%450 = OpSampledImage %449 %442 %441 +%451 = OpImageSampleDrefImplicitLod %8 %450 %302 %300 +%452 = OpLoad %8 %445 +%453 = OpFAdd %8 %452 %451 +OpLine %3 158 5 +OpStore %445 %453 +OpLine %3 159 5 +%455 = OpConvertUToF %8 %220 +%456 = OpCompositeConstruct %303 %302 %455 +%457 = OpSampledImage %454 %443 %441 +%458 = OpImageSampleDrefImplicitLod %8 %457 %456 %300 +%459 = OpLoad %8 %445 +%460 = OpFAdd %8 %459 %458 +OpLine %3 159 5 +OpStore %445 %460 +OpLine %3 160 5 +%461 = OpConvertSToF %8 %82 +%462 = OpCompositeConstruct %303 %302 %461 +%463 = OpSampledImage %454 %443 %441 +%464 = OpImageSampleDrefImplicitLod %8 %463 %462 %300 +%465 = OpLoad %8 %445 +%466 = OpFAdd %8 %465 %464 +OpLine %3 160 5 +OpStore %445 %466 +OpLine %3 161 5 +%468 = OpSampledImage %467 %444 %441 +%469 = OpImageSampleDrefImplicitLod %8 %468 %304 %300 +%470 = OpLoad %8 %445 +%471 = OpFAdd %8 %470 %469 +OpLine %3 161 5 +OpStore %445 %471 +OpLine %3 162 5 +%472 = OpSampledImage %449 %442 %441 +%473 = OpImageSampleDrefExplicitLod %8 %472 %302 %300 Lod %474 +%475 = OpLoad %8 %445 +%476 = OpFAdd %8 %475 %473 +OpLine %3 162 5 +OpStore %445 %476 +OpLine %3 163 5 +%477 = OpConvertUToF %8 %220 +%478 = OpCompositeConstruct %303 %302 %477 +%479 = OpSampledImage %454 %443 %441 +%480 = OpImageSampleDrefExplicitLod %8 %479 %478 %300 Lod %474 +%481 = OpLoad %8 %445 +%482 = OpFAdd %8 %481 %480 +OpLine %3 163 5 +OpStore %445 %482 +OpLine %3 164 5 +%483 = OpConvertSToF %8 %82 +%484 = OpCompositeConstruct %303 %302 %483 +%485 = OpSampledImage %454 %443 %441 +%486 = OpImageSampleDrefExplicitLod %8 %485 %484 %300 Lod %474 +%487 = OpLoad %8 %445 +%488 = OpFAdd %8 %487 %486 +OpLine %3 164 5 +OpStore %445 %488 +OpLine %3 165 5 +%489 = OpSampledImage %467 %444 %441 +%490 = OpImageSampleDrefExplicitLod %8 %489 %304 %300 Lod %474 +%491 = OpLoad %8 %445 +%492 = OpFAdd %8 %491 %490 +OpLine %3 165 5 +OpStore %445 %492 +OpLine %3 1 1 +%493 = OpLoad %8 %445 +OpStore %438 %493 OpReturn OpFunctionEnd -%495 = OpFunction %2 None %100 -%493 = OpLabel -%496 = OpLoad %16 %49 -%497 = OpLoad %3 %51 -%498 = OpLoad %17 %52 -%499 = OpLoad %24 %64 -%500 = OpLoad %24 %66 -%501 = OpLoad %25 %68 -OpBranch %502 -%502 = OpLabel -%503 = OpSampledImage %316 %496 %499 -%504 = OpImageGather %23 %503 %301 %505 -%506 = OpSampledImage %316 %496 %499 -%507 = OpImageGather %23 %506 %301 %508 ConstOffset %30 -%509 = OpSampledImage %448 %501 %500 -%510 = OpImageDrefGather %23 %509 %301 %299 -%511 = OpSampledImage %448 %501 %500 -%512 = OpImageDrefGather %23 %511 %301 %299 ConstOffset %30 -%514 = OpSampledImage %513 %497 %499 -%515 = OpImageGather %119 %514 %301 %219 -%518 = OpSampledImage %517 %498 %499 -%519 = OpImageGather %516 %518 %301 %219 -%520 = OpConvertUToF %23 %515 -%521 = OpConvertSToF %23 %519 -%522 = OpFAdd %23 %520 %521 -%523 = OpFAdd %23 %504 %507 -%524 = OpFAdd %23 %523 %510 -%525 = OpFAdd %23 %524 %512 -%526 = OpFAdd %23 %525 %522 -OpStore %494 %526 +%496 = OpFunction %2 None %101 +%494 = OpLabel +%497 = OpLoad %17 %50 +%498 = OpLoad %4 %52 +%499 = OpLoad %18 %53 +%500 = OpLoad %25 %65 +%501 = OpLoad %25 %67 +%502 = OpLoad %26 %69 +OpBranch %503 +%503 = OpLabel +OpLine %3 171 14 +OpLine %3 173 15 +%504 = OpSampledImage %317 %497 %500 +%505 = OpImageGather %24 %504 %302 %506 +OpLine %3 174 22 +%507 = OpSampledImage %317 %497 %500 +%508 = OpImageGather %24 %507 %302 %509 ConstOffset %31 +OpLine %3 175 21 +%510 = OpSampledImage %449 %502 %501 +%511 = OpImageDrefGather %24 %510 %302 %300 +OpLine %3 176 28 +%512 = OpSampledImage %449 %502 %501 +%513 = OpImageDrefGather %24 %512 %302 %300 ConstOffset %31 +OpLine %3 178 13 +%515 = OpSampledImage %514 %498 %500 +%516 = OpImageGather %120 %515 %302 %220 +OpLine %3 179 13 +%519 = OpSampledImage %518 %499 %500 +%520 = OpImageGather %517 %519 %302 %220 +OpLine %3 180 13 +%521 = OpConvertUToF %24 %516 +%522 = OpConvertSToF %24 %520 +%523 = OpFAdd %24 %521 %522 +OpLine %3 182 12 +%524 = OpFAdd %24 %505 %508 +%525 = OpFAdd %24 %524 %511 +%526 = OpFAdd %24 %525 %513 +%527 = OpFAdd %24 %526 %523 +OpStore %495 %527 OpReturn OpFunctionEnd -%529 = OpFunction %2 None %100 -%527 = OpLabel -%530 = OpLoad %24 %64 -%531 = OpLoad %25 %68 -OpBranch %532 -%532 = OpLabel -%533 = OpSampledImage %448 %531 %530 -%534 = OpImageSampleImplicitLod %23 %533 %301 -%535 = OpCompositeExtract %7 %534 0 -%536 = OpSampledImage %448 %531 %530 -%537 = OpImageGather %23 %536 %301 %219 -%538 = OpSampledImage %448 %531 %530 -%540 = OpConvertSToF %7 %29 -%539 = OpImageSampleExplicitLod %23 %538 %301 Lod %540 -%541 = OpCompositeExtract %7 %539 0 -%542 = OpCompositeConstruct %23 %535 %535 %535 %535 -%543 = OpFAdd %23 %542 %537 -%544 = OpCompositeConstruct %23 %541 %541 %541 %541 -%545 = OpFAdd %23 %543 %544 -OpStore %528 %545 +%530 = OpFunction %2 None %101 +%528 = OpLabel +%531 = OpLoad %25 %65 +%532 = OpLoad %26 %69 +OpBranch %533 +%533 = OpLabel +OpLine %3 187 14 +OpLine %3 189 15 +%534 = OpSampledImage %449 %532 %531 +%535 = OpImageSampleImplicitLod %24 %534 %302 +%536 = OpCompositeExtract %8 %535 0 +OpLine %3 190 22 +%537 = OpSampledImage %449 %532 %531 +%538 = OpImageGather %24 %537 %302 %220 +OpLine %3 191 21 +%539 = OpSampledImage %449 %532 %531 +%541 = OpConvertSToF %8 %30 +%540 = OpImageSampleExplicitLod %24 %539 %302 Lod %541 +%542 = OpCompositeExtract %8 %540 0 +OpLine %3 189 15 +%543 = OpCompositeConstruct %24 %536 %536 %536 %536 +%544 = OpFAdd %24 %543 %538 +%545 = OpCompositeConstruct %24 %542 %542 %542 %542 +%546 = OpFAdd %24 %544 %545 +OpStore %529 %546 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/interpolate.spvasm b/naga/tests/out/spv/interpolate.spvasm index f40c257408..84af066122 100644 --- a/naga/tests/out/spv/interpolate.spvasm +++ b/naga/tests/out/spv/interpolate.spvasm @@ -1,279 +1,352 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 139 +; Bound: 140 OpCapability Shader OpCapability SampleRateShading %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %30 "vert_main" %10 %12 %14 %15 %16 %18 %20 %22 %23 %24 %25 %26 %27 -OpEntryPoint Fragment %137 "frag_main" %108 %111 %114 %116 %118 %121 %124 %127 %129 %131 %133 %135 -OpExecutionMode %137 OriginUpperLeft -OpMemberName %8 0 "position" -OpMemberName %8 1 "_flat" -OpMemberName %8 2 "flat_first" -OpMemberName %8 3 "flat_either" -OpMemberName %8 4 "_linear" -OpMemberName %8 5 "linear_centroid" -OpMemberName %8 6 "linear_sample" -OpMemberName %8 7 "linear_center" -OpMemberName %8 8 "perspective" -OpMemberName %8 9 "perspective_centroid" -OpMemberName %8 10 "perspective_sample" -OpMemberName %8 11 "perspective_center" -OpName %8 "FragmentInput" -OpName %10 "position" -OpName %12 "_flat" -OpName %14 "flat_first" -OpName %15 "flat_either" -OpName %16 "_linear" -OpName %18 "linear_centroid" -OpName %20 "linear_sample" -OpName %22 "linear_center" -OpName %23 "perspective" -OpName %24 "perspective_centroid" -OpName %25 "perspective_sample" -OpName %26 "perspective_center" -OpName %30 "vert_main" -OpName %60 "out" -OpName %108 "position" -OpName %111 "_flat" -OpName %114 "flat_first" -OpName %116 "flat_either" -OpName %118 "_linear" -OpName %121 "linear_centroid" -OpName %124 "linear_sample" -OpName %127 "linear_center" -OpName %129 "perspective" -OpName %131 "perspective_centroid" -OpName %133 "perspective_sample" -OpName %135 "perspective_center" -OpName %137 "frag_main" -OpMemberDecorate %8 0 Offset 0 -OpMemberDecorate %8 1 Offset 16 -OpMemberDecorate %8 2 Offset 20 -OpMemberDecorate %8 3 Offset 24 -OpMemberDecorate %8 4 Offset 28 -OpMemberDecorate %8 5 Offset 32 -OpMemberDecorate %8 6 Offset 48 -OpMemberDecorate %8 7 Offset 64 -OpMemberDecorate %8 8 Offset 80 -OpMemberDecorate %8 9 Offset 96 -OpMemberDecorate %8 10 Offset 100 -OpMemberDecorate %8 11 Offset 104 -OpDecorate %10 BuiltIn Position -OpDecorate %12 Location 0 -OpDecorate %12 Flat -OpDecorate %14 Location 1 -OpDecorate %14 Flat -OpDecorate %15 Location 2 +OpEntryPoint Vertex %31 "vert_main" %11 %13 %15 %16 %17 %19 %21 %23 %24 %25 %26 %27 %28 +OpEntryPoint Fragment %138 "frag_main" %109 %112 %115 %117 %119 %122 %125 %128 %130 %132 %134 %136 +OpExecutionMode %138 OriginUpperLeft +%3 = OpString "interpolate.wgsl" +OpSource Unknown 0 %3 "//TODO: merge with \"interface\"? + +// NOTE: invalid combinations are tested in the +// `validation::incompatible_interpolation_and_sampling_types` test. +struct FragmentInput { + @builtin(position) position: vec4, + @location(0) @interpolate(flat) _flat : u32, + @location(1) @interpolate(flat, first) flat_first : u32, + @location(2) @interpolate(flat, either) flat_either : u32, + @location(3) @interpolate(linear) _linear : f32, + @location(4) @interpolate(linear, centroid) linear_centroid : vec2, + @location(6) @interpolate(linear, sample) linear_sample : vec3, + @location(7) @interpolate(linear, center) linear_center : vec3, + @location(8) @interpolate(perspective) perspective : vec4, + @location(9) @interpolate(perspective, centroid) perspective_centroid : f32, + @location(10) @interpolate(perspective, sample) perspective_sample : f32, + @location(11) @interpolate(perspective, center) perspective_center : f32, +} + +@vertex +fn vert_main() -> FragmentInput { + var out: FragmentInput; + + out.position = vec4(2.0, 4.0, 5.0, 6.0); + out._flat = 8u; + out.flat_first = 9u; + out.flat_either = 10u; + out._linear = 27.0; + out.linear_centroid = vec2(64.0, 125.0); + out.linear_sample = vec3(216.0, 343.0, 512.0); + out.linear_center = vec3(255.0, 511.0, 1024.0); + out.perspective = vec4(729.0, 1000.0, 1331.0, 1728.0); + out.perspective_centroid = 2197.0; + out.perspective_sample = 2744.0; + out.perspective_center = 2812.0; + + return out; +} + +@fragment +fn frag_main(val : FragmentInput) { } +" +OpMemberName %9 0 "position" +OpMemberName %9 1 "_flat" +OpMemberName %9 2 "flat_first" +OpMemberName %9 3 "flat_either" +OpMemberName %9 4 "_linear" +OpMemberName %9 5 "linear_centroid" +OpMemberName %9 6 "linear_sample" +OpMemberName %9 7 "linear_center" +OpMemberName %9 8 "perspective" +OpMemberName %9 9 "perspective_centroid" +OpMemberName %9 10 "perspective_sample" +OpMemberName %9 11 "perspective_center" +OpName %9 "FragmentInput" +OpName %11 "position" +OpName %13 "_flat" +OpName %15 "flat_first" +OpName %16 "flat_either" +OpName %17 "_linear" +OpName %19 "linear_centroid" +OpName %21 "linear_sample" +OpName %23 "linear_center" +OpName %24 "perspective" +OpName %25 "perspective_centroid" +OpName %26 "perspective_sample" +OpName %27 "perspective_center" +OpName %31 "vert_main" +OpName %61 "out" +OpName %109 "position" +OpName %112 "_flat" +OpName %115 "flat_first" +OpName %117 "flat_either" +OpName %119 "_linear" +OpName %122 "linear_centroid" +OpName %125 "linear_sample" +OpName %128 "linear_center" +OpName %130 "perspective" +OpName %132 "perspective_centroid" +OpName %134 "perspective_sample" +OpName %136 "perspective_center" +OpName %138 "frag_main" +OpMemberDecorate %9 0 Offset 0 +OpMemberDecorate %9 1 Offset 16 +OpMemberDecorate %9 2 Offset 20 +OpMemberDecorate %9 3 Offset 24 +OpMemberDecorate %9 4 Offset 28 +OpMemberDecorate %9 5 Offset 32 +OpMemberDecorate %9 6 Offset 48 +OpMemberDecorate %9 7 Offset 64 +OpMemberDecorate %9 8 Offset 80 +OpMemberDecorate %9 9 Offset 96 +OpMemberDecorate %9 10 Offset 100 +OpMemberDecorate %9 11 Offset 104 +OpDecorate %11 BuiltIn Position +OpDecorate %13 Location 0 +OpDecorate %13 Flat +OpDecorate %15 Location 1 OpDecorate %15 Flat -OpDecorate %16 Location 3 -OpDecorate %16 NoPerspective -OpDecorate %18 Location 4 -OpDecorate %18 NoPerspective -OpDecorate %18 Centroid -OpDecorate %20 Location 6 -OpDecorate %20 NoPerspective -OpDecorate %20 Sample -OpDecorate %22 Location 7 -OpDecorate %22 NoPerspective -OpDecorate %23 Location 8 -OpDecorate %24 Location 9 -OpDecorate %24 Centroid -OpDecorate %25 Location 10 -OpDecorate %25 Sample -OpDecorate %26 Location 11 -OpDecorate %27 BuiltIn PointSize -OpDecorate %108 BuiltIn FragCoord -OpDecorate %111 Location 0 -OpDecorate %111 Flat -OpDecorate %114 Location 1 -OpDecorate %114 Flat -OpDecorate %116 Location 2 -OpDecorate %116 Flat -OpDecorate %118 Location 3 -OpDecorate %118 NoPerspective -OpDecorate %121 Location 4 -OpDecorate %121 NoPerspective -OpDecorate %121 Centroid -OpDecorate %124 Location 6 -OpDecorate %124 NoPerspective -OpDecorate %124 Sample -OpDecorate %127 Location 7 -OpDecorate %127 NoPerspective -OpDecorate %129 Location 8 -OpDecorate %131 Location 9 -OpDecorate %131 Centroid -OpDecorate %133 Location 10 -OpDecorate %133 Sample -OpDecorate %135 Location 11 +OpDecorate %16 Location 2 +OpDecorate %16 Flat +OpDecorate %17 Location 3 +OpDecorate %17 NoPerspective +OpDecorate %19 Location 4 +OpDecorate %19 NoPerspective +OpDecorate %19 Centroid +OpDecorate %21 Location 6 +OpDecorate %21 NoPerspective +OpDecorate %21 Sample +OpDecorate %23 Location 7 +OpDecorate %23 NoPerspective +OpDecorate %24 Location 8 +OpDecorate %25 Location 9 +OpDecorate %25 Centroid +OpDecorate %26 Location 10 +OpDecorate %26 Sample +OpDecorate %27 Location 11 +OpDecorate %28 BuiltIn PointSize +OpDecorate %109 BuiltIn FragCoord +OpDecorate %112 Location 0 +OpDecorate %112 Flat +OpDecorate %115 Location 1 +OpDecorate %115 Flat +OpDecorate %117 Location 2 +OpDecorate %117 Flat +OpDecorate %119 Location 3 +OpDecorate %119 NoPerspective +OpDecorate %122 Location 4 +OpDecorate %122 NoPerspective +OpDecorate %122 Centroid +OpDecorate %125 Location 6 +OpDecorate %125 NoPerspective +OpDecorate %125 Sample +OpDecorate %128 Location 7 +OpDecorate %128 NoPerspective +OpDecorate %130 Location 8 +OpDecorate %132 Location 9 +OpDecorate %132 Centroid +OpDecorate %134 Location 10 +OpDecorate %134 Sample +OpDecorate %136 Location 11 %2 = OpTypeVoid -%3 = OpTypeFloat 32 -%4 = OpTypeVector %3 4 -%5 = OpTypeInt 32 0 -%6 = OpTypeVector %3 2 -%7 = OpTypeVector %3 3 -%8 = OpTypeStruct %4 %5 %5 %5 %3 %6 %7 %7 %4 %3 %3 %3 -%11 = OpTypePointer Output %4 -%10 = OpVariable %11 Output -%13 = OpTypePointer Output %5 -%12 = OpVariable %13 Output -%14 = OpVariable %13 Output -%15 = OpVariable %13 Output -%17 = OpTypePointer Output %3 -%16 = OpVariable %17 Output -%19 = OpTypePointer Output %6 -%18 = OpVariable %19 Output -%21 = OpTypePointer Output %7 -%20 = OpVariable %21 Output -%22 = OpVariable %21 Output -%23 = OpVariable %11 Output -%24 = OpVariable %17 Output -%25 = OpVariable %17 Output -%26 = OpVariable %17 Output -%28 = OpTypePointer Output %3 -%27 = OpVariable %28 Output -%29 = OpConstant %3 1.0 -%31 = OpTypeFunction %2 -%32 = OpConstant %3 2.0 -%33 = OpConstant %3 4.0 -%34 = OpConstant %3 5.0 -%35 = OpConstant %3 6.0 -%36 = OpConstantComposite %4 %32 %33 %34 %35 -%37 = OpConstant %5 8 -%38 = OpConstant %5 9 -%39 = OpConstant %5 10 -%40 = OpConstant %3 27.0 -%41 = OpConstant %3 64.0 -%42 = OpConstant %3 125.0 -%43 = OpConstantComposite %6 %41 %42 -%44 = OpConstant %3 216.0 -%45 = OpConstant %3 343.0 -%46 = OpConstant %3 512.0 -%47 = OpConstantComposite %7 %44 %45 %46 -%48 = OpConstant %3 255.0 -%49 = OpConstant %3 511.0 -%50 = OpConstant %3 1024.0 -%51 = OpConstantComposite %7 %48 %49 %50 -%52 = OpConstant %3 729.0 -%53 = OpConstant %3 1000.0 -%54 = OpConstant %3 1331.0 -%55 = OpConstant %3 1728.0 -%56 = OpConstantComposite %4 %52 %53 %54 %55 -%57 = OpConstant %3 2197.0 -%58 = OpConstant %3 2744.0 -%59 = OpConstant %3 2812.0 -%61 = OpTypePointer Function %8 -%62 = OpConstantNull %8 -%64 = OpTypePointer Function %4 -%65 = OpConstant %5 0 -%67 = OpTypePointer Function %5 -%68 = OpConstant %5 1 -%70 = OpConstant %5 2 -%72 = OpConstant %5 3 -%74 = OpTypePointer Function %3 -%75 = OpConstant %5 4 -%77 = OpTypePointer Function %6 -%78 = OpConstant %5 5 -%80 = OpTypePointer Function %7 -%81 = OpConstant %5 6 -%83 = OpConstant %5 7 -%88 = OpConstant %5 11 -%109 = OpTypePointer Input %4 -%108 = OpVariable %109 Input -%112 = OpTypePointer Input %5 -%111 = OpVariable %112 Input -%114 = OpVariable %112 Input -%116 = OpVariable %112 Input -%119 = OpTypePointer Input %3 -%118 = OpVariable %119 Input -%122 = OpTypePointer Input %6 -%121 = OpVariable %122 Input -%125 = OpTypePointer Input %7 -%124 = OpVariable %125 Input -%127 = OpVariable %125 Input -%129 = OpVariable %109 Input -%131 = OpVariable %119 Input -%133 = OpVariable %119 Input -%135 = OpVariable %119 Input -%30 = OpFunction %2 None %31 -%9 = OpLabel -%60 = OpVariable %61 Function %62 -OpStore %27 %29 -OpBranch %63 -%63 = OpLabel -%66 = OpAccessChain %64 %60 %65 -OpStore %66 %36 -%69 = OpAccessChain %67 %60 %68 -OpStore %69 %37 -%71 = OpAccessChain %67 %60 %70 -OpStore %71 %38 -%73 = OpAccessChain %67 %60 %72 -OpStore %73 %39 -%76 = OpAccessChain %74 %60 %75 -OpStore %76 %40 -%79 = OpAccessChain %77 %60 %78 -OpStore %79 %43 -%82 = OpAccessChain %80 %60 %81 -OpStore %82 %47 -%84 = OpAccessChain %80 %60 %83 -OpStore %84 %51 -%85 = OpAccessChain %64 %60 %37 -OpStore %85 %56 -%86 = OpAccessChain %74 %60 %38 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 4 +%6 = OpTypeInt 32 0 +%7 = OpTypeVector %4 2 +%8 = OpTypeVector %4 3 +%9 = OpTypeStruct %5 %6 %6 %6 %4 %7 %8 %8 %5 %4 %4 %4 +%12 = OpTypePointer Output %5 +%11 = OpVariable %12 Output +%14 = OpTypePointer Output %6 +%13 = OpVariable %14 Output +%15 = OpVariable %14 Output +%16 = OpVariable %14 Output +%18 = OpTypePointer Output %4 +%17 = OpVariable %18 Output +%20 = OpTypePointer Output %7 +%19 = OpVariable %20 Output +%22 = OpTypePointer Output %8 +%21 = OpVariable %22 Output +%23 = OpVariable %22 Output +%24 = OpVariable %12 Output +%25 = OpVariable %18 Output +%26 = OpVariable %18 Output +%27 = OpVariable %18 Output +%29 = OpTypePointer Output %4 +%28 = OpVariable %29 Output +%30 = OpConstant %4 1.0 +%32 = OpTypeFunction %2 +%33 = OpConstant %4 2.0 +%34 = OpConstant %4 4.0 +%35 = OpConstant %4 5.0 +%36 = OpConstant %4 6.0 +%37 = OpConstantComposite %5 %33 %34 %35 %36 +%38 = OpConstant %6 8 +%39 = OpConstant %6 9 +%40 = OpConstant %6 10 +%41 = OpConstant %4 27.0 +%42 = OpConstant %4 64.0 +%43 = OpConstant %4 125.0 +%44 = OpConstantComposite %7 %42 %43 +%45 = OpConstant %4 216.0 +%46 = OpConstant %4 343.0 +%47 = OpConstant %4 512.0 +%48 = OpConstantComposite %8 %45 %46 %47 +%49 = OpConstant %4 255.0 +%50 = OpConstant %4 511.0 +%51 = OpConstant %4 1024.0 +%52 = OpConstantComposite %8 %49 %50 %51 +%53 = OpConstant %4 729.0 +%54 = OpConstant %4 1000.0 +%55 = OpConstant %4 1331.0 +%56 = OpConstant %4 1728.0 +%57 = OpConstantComposite %5 %53 %54 %55 %56 +%58 = OpConstant %4 2197.0 +%59 = OpConstant %4 2744.0 +%60 = OpConstant %4 2812.0 +%62 = OpTypePointer Function %9 +%63 = OpConstantNull %9 +%65 = OpTypePointer Function %5 +%66 = OpConstant %6 0 +%68 = OpTypePointer Function %6 +%69 = OpConstant %6 1 +%71 = OpConstant %6 2 +%73 = OpConstant %6 3 +%75 = OpTypePointer Function %4 +%76 = OpConstant %6 4 +%78 = OpTypePointer Function %7 +%79 = OpConstant %6 5 +%81 = OpTypePointer Function %8 +%82 = OpConstant %6 6 +%84 = OpConstant %6 7 +%89 = OpConstant %6 11 +%110 = OpTypePointer Input %5 +%109 = OpVariable %110 Input +%113 = OpTypePointer Input %6 +%112 = OpVariable %113 Input +%115 = OpVariable %113 Input +%117 = OpVariable %113 Input +%120 = OpTypePointer Input %4 +%119 = OpVariable %120 Input +%123 = OpTypePointer Input %7 +%122 = OpVariable %123 Input +%126 = OpTypePointer Input %8 +%125 = OpVariable %126 Input +%128 = OpVariable %126 Input +%130 = OpVariable %110 Input +%132 = OpVariable %120 Input +%134 = OpVariable %120 Input +%136 = OpVariable %120 Input +%31 = OpFunction %2 None %32 +%10 = OpLabel +%61 = OpVariable %62 Function %63 +OpStore %28 %30 +OpBranch %64 +%64 = OpLabel +OpLine %3 24 4 +OpLine %3 24 19 +OpLine %3 24 4 +%67 = OpAccessChain %65 %61 %66 +OpStore %67 %37 +OpLine %3 25 4 +OpLine %3 25 4 +%70 = OpAccessChain %68 %61 %69 +OpStore %70 %38 +OpLine %3 26 4 +OpLine %3 26 4 +%72 = OpAccessChain %68 %61 %71 +OpStore %72 %39 +OpLine %3 27 4 +OpLine %3 27 4 +%74 = OpAccessChain %68 %61 %73 +OpStore %74 %40 +OpLine %3 28 4 +OpLine %3 28 4 +%77 = OpAccessChain %75 %61 %76 +OpStore %77 %41 +OpLine %3 29 4 +OpLine %3 29 26 +OpLine %3 29 4 +%80 = OpAccessChain %78 %61 %79 +OpStore %80 %44 +OpLine %3 30 4 +OpLine %3 30 24 +OpLine %3 30 4 +%83 = OpAccessChain %81 %61 %82 +OpStore %83 %48 +OpLine %3 31 4 +OpLine %3 31 24 +OpLine %3 31 4 +%85 = OpAccessChain %81 %61 %84 +OpStore %85 %52 +OpLine %3 32 4 +OpLine %3 32 22 +OpLine %3 32 4 +%86 = OpAccessChain %65 %61 %38 OpStore %86 %57 -%87 = OpAccessChain %74 %60 %39 +OpLine %3 33 4 +OpLine %3 33 4 +%87 = OpAccessChain %75 %61 %39 OpStore %87 %58 -%89 = OpAccessChain %74 %60 %88 -OpStore %89 %59 -%90 = OpLoad %8 %60 -%91 = OpCompositeExtract %4 %90 0 -OpStore %10 %91 -%92 = OpAccessChain %28 %10 %68 -%93 = OpLoad %3 %92 -%94 = OpFNegate %3 %93 -OpStore %92 %94 -%95 = OpCompositeExtract %5 %90 1 -OpStore %12 %95 -%96 = OpCompositeExtract %5 %90 2 -OpStore %14 %96 -%97 = OpCompositeExtract %5 %90 3 +OpLine %3 34 4 +OpLine %3 34 4 +%88 = OpAccessChain %75 %61 %40 +OpStore %88 %59 +OpLine %3 35 4 +OpLine %3 35 4 +%90 = OpAccessChain %75 %61 %89 +OpStore %90 %60 +OpLine %3 1 1 +%91 = OpLoad %9 %61 +%92 = OpCompositeExtract %5 %91 0 +OpStore %11 %92 +%93 = OpAccessChain %29 %11 %69 +%94 = OpLoad %4 %93 +%95 = OpFNegate %4 %94 +OpStore %93 %95 +%96 = OpCompositeExtract %6 %91 1 +OpStore %13 %96 +%97 = OpCompositeExtract %6 %91 2 OpStore %15 %97 -%98 = OpCompositeExtract %3 %90 4 +%98 = OpCompositeExtract %6 %91 3 OpStore %16 %98 -%99 = OpCompositeExtract %6 %90 5 -OpStore %18 %99 -%100 = OpCompositeExtract %7 %90 6 -OpStore %20 %100 -%101 = OpCompositeExtract %7 %90 7 -OpStore %22 %101 -%102 = OpCompositeExtract %4 %90 8 +%99 = OpCompositeExtract %4 %91 4 +OpStore %17 %99 +%100 = OpCompositeExtract %7 %91 5 +OpStore %19 %100 +%101 = OpCompositeExtract %8 %91 6 +OpStore %21 %101 +%102 = OpCompositeExtract %8 %91 7 OpStore %23 %102 -%103 = OpCompositeExtract %3 %90 9 +%103 = OpCompositeExtract %5 %91 8 OpStore %24 %103 -%104 = OpCompositeExtract %3 %90 10 +%104 = OpCompositeExtract %4 %91 9 OpStore %25 %104 -%105 = OpCompositeExtract %3 %90 11 +%105 = OpCompositeExtract %4 %91 10 OpStore %26 %105 +%106 = OpCompositeExtract %4 %91 11 +OpStore %27 %106 OpReturn OpFunctionEnd -%137 = OpFunction %2 None %31 -%106 = OpLabel -%110 = OpLoad %4 %108 -%113 = OpLoad %5 %111 -%115 = OpLoad %5 %114 -%117 = OpLoad %5 %116 -%120 = OpLoad %3 %118 -%123 = OpLoad %6 %121 -%126 = OpLoad %7 %124 -%128 = OpLoad %7 %127 -%130 = OpLoad %4 %129 -%132 = OpLoad %3 %131 -%134 = OpLoad %3 %133 -%136 = OpLoad %3 %135 -%107 = OpCompositeConstruct %8 %110 %113 %115 %117 %120 %123 %126 %128 %130 %132 %134 %136 -OpBranch %138 -%138 = OpLabel +%138 = OpFunction %2 None %32 +%107 = OpLabel +%111 = OpLoad %5 %109 +%114 = OpLoad %6 %112 +%116 = OpLoad %6 %115 +%118 = OpLoad %6 %117 +%121 = OpLoad %4 %119 +%124 = OpLoad %7 %122 +%127 = OpLoad %8 %125 +%129 = OpLoad %8 %128 +%131 = OpLoad %5 %130 +%133 = OpLoad %4 %132 +%135 = OpLoad %4 %134 +%137 = OpLoad %4 %136 +%108 = OpCompositeConstruct %9 %111 %114 %116 %118 %121 %124 %127 %129 %131 %133 %135 %137 +OpBranch %139 +%139 = OpLabel OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/interpolate_compat.spvasm b/naga/tests/out/spv/interpolate_compat.spvasm index 90f7237fd1..d22c5ed540 100644 --- a/naga/tests/out/spv/interpolate_compat.spvasm +++ b/naga/tests/out/spv/interpolate_compat.spvasm @@ -1,263 +1,336 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 133 +; Bound: 134 OpCapability Shader OpCapability SampleRateShading %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %29 "vert_main" %10 %12 %14 %15 %17 %19 %21 %22 %23 %24 %25 %26 -OpEntryPoint Fragment %131 "frag_main" %104 %107 %110 %112 %115 %118 %121 %123 %125 %127 %129 -OpExecutionMode %131 OriginUpperLeft -OpMemberName %8 0 "position" -OpMemberName %8 1 "_flat" -OpMemberName %8 2 "flat_either" -OpMemberName %8 3 "_linear" -OpMemberName %8 4 "linear_centroid" -OpMemberName %8 5 "linear_sample" -OpMemberName %8 6 "linear_center" -OpMemberName %8 7 "perspective" -OpMemberName %8 8 "perspective_centroid" -OpMemberName %8 9 "perspective_sample" -OpMemberName %8 10 "perspective_center" -OpName %8 "FragmentInput" -OpName %10 "position" -OpName %12 "_flat" -OpName %14 "flat_either" -OpName %15 "_linear" -OpName %17 "linear_centroid" -OpName %19 "linear_sample" -OpName %21 "linear_center" -OpName %22 "perspective" -OpName %23 "perspective_centroid" -OpName %24 "perspective_sample" -OpName %25 "perspective_center" -OpName %29 "vert_main" -OpName %58 "out" -OpName %104 "position" -OpName %107 "_flat" -OpName %110 "flat_either" -OpName %112 "_linear" -OpName %115 "linear_centroid" -OpName %118 "linear_sample" -OpName %121 "linear_center" -OpName %123 "perspective" -OpName %125 "perspective_centroid" -OpName %127 "perspective_sample" -OpName %129 "perspective_center" -OpName %131 "frag_main" -OpMemberDecorate %8 0 Offset 0 -OpMemberDecorate %8 1 Offset 16 -OpMemberDecorate %8 2 Offset 20 -OpMemberDecorate %8 3 Offset 24 -OpMemberDecorate %8 4 Offset 32 -OpMemberDecorate %8 5 Offset 48 -OpMemberDecorate %8 6 Offset 64 -OpMemberDecorate %8 7 Offset 80 -OpMemberDecorate %8 8 Offset 96 -OpMemberDecorate %8 9 Offset 100 -OpMemberDecorate %8 10 Offset 104 -OpDecorate %10 BuiltIn Position -OpDecorate %12 Location 0 -OpDecorate %12 Flat -OpDecorate %14 Location 2 -OpDecorate %14 Flat -OpDecorate %15 Location 3 -OpDecorate %15 NoPerspective -OpDecorate %17 Location 4 -OpDecorate %17 NoPerspective -OpDecorate %17 Centroid -OpDecorate %19 Location 6 -OpDecorate %19 NoPerspective -OpDecorate %19 Sample -OpDecorate %21 Location 7 -OpDecorate %21 NoPerspective -OpDecorate %22 Location 8 -OpDecorate %23 Location 9 -OpDecorate %23 Centroid -OpDecorate %24 Location 10 -OpDecorate %24 Sample -OpDecorate %25 Location 11 -OpDecorate %26 BuiltIn PointSize -OpDecorate %104 BuiltIn FragCoord -OpDecorate %107 Location 0 -OpDecorate %107 Flat -OpDecorate %110 Location 2 -OpDecorate %110 Flat -OpDecorate %112 Location 3 -OpDecorate %112 NoPerspective -OpDecorate %115 Location 4 -OpDecorate %115 NoPerspective -OpDecorate %115 Centroid -OpDecorate %118 Location 6 -OpDecorate %118 NoPerspective -OpDecorate %118 Sample -OpDecorate %121 Location 7 -OpDecorate %121 NoPerspective -OpDecorate %123 Location 8 -OpDecorate %125 Location 9 -OpDecorate %125 Centroid -OpDecorate %127 Location 10 -OpDecorate %127 Sample -OpDecorate %129 Location 11 +OpEntryPoint Vertex %30 "vert_main" %11 %13 %15 %16 %18 %20 %22 %23 %24 %25 %26 %27 +OpEntryPoint Fragment %132 "frag_main" %105 %108 %111 %113 %116 %119 %122 %124 %126 %128 %130 +OpExecutionMode %132 OriginUpperLeft +%3 = OpString "interpolate_compat.wgsl" +OpSource Unknown 0 %3 "// NOTE: This is basically the same as `interpolate.wgsl`, except for the removal of +// `@interpolate(flat, first)`, which is unsupported in GLSL and `compat`. + +// NOTE: invalid combinations are tested in the +// `validation::incompatible_interpolation_and_sampling_types` test. +struct FragmentInput { + @builtin(position) position: vec4, + @location(0) @interpolate(flat) _flat : u32, + // NOTE: not supported in `compat` or GLSL + // // @location(1) @interpolate(flat, first) flat_first : u32, + @location(2) @interpolate(flat, either) flat_either : u32, + @location(3) @interpolate(linear) _linear : f32, + @location(4) @interpolate(linear, centroid) linear_centroid : vec2, + @location(6) @interpolate(linear, sample) linear_sample : vec3, + @location(7) @interpolate(linear, center) linear_center : vec3, + @location(8) @interpolate(perspective) perspective : vec4, + @location(9) @interpolate(perspective, centroid) perspective_centroid : f32, + @location(10) @interpolate(perspective, sample) perspective_sample : f32, + @location(11) @interpolate(perspective, center) perspective_center : f32, +} + +@vertex +fn vert_main() -> FragmentInput { + var out: FragmentInput; + + out.position = vec4(2.0, 4.0, 5.0, 6.0); + out._flat = 8u; + // out.flat_first = 9u; + out.flat_either = 10u; + out._linear = 27.0; + out.linear_centroid = vec2(64.0, 125.0); + out.linear_sample = vec3(216.0, 343.0, 512.0); + out.linear_center = vec3(255.0, 511.0, 1024.0); + out.perspective = vec4(729.0, 1000.0, 1331.0, 1728.0); + out.perspective_centroid = 2197.0; + out.perspective_sample = 2744.0; + out.perspective_center = 2812.0; + + return out; +} + +@fragment +fn frag_main(val : FragmentInput) { } +" +OpMemberName %9 0 "position" +OpMemberName %9 1 "_flat" +OpMemberName %9 2 "flat_either" +OpMemberName %9 3 "_linear" +OpMemberName %9 4 "linear_centroid" +OpMemberName %9 5 "linear_sample" +OpMemberName %9 6 "linear_center" +OpMemberName %9 7 "perspective" +OpMemberName %9 8 "perspective_centroid" +OpMemberName %9 9 "perspective_sample" +OpMemberName %9 10 "perspective_center" +OpName %9 "FragmentInput" +OpName %11 "position" +OpName %13 "_flat" +OpName %15 "flat_either" +OpName %16 "_linear" +OpName %18 "linear_centroid" +OpName %20 "linear_sample" +OpName %22 "linear_center" +OpName %23 "perspective" +OpName %24 "perspective_centroid" +OpName %25 "perspective_sample" +OpName %26 "perspective_center" +OpName %30 "vert_main" +OpName %59 "out" +OpName %105 "position" +OpName %108 "_flat" +OpName %111 "flat_either" +OpName %113 "_linear" +OpName %116 "linear_centroid" +OpName %119 "linear_sample" +OpName %122 "linear_center" +OpName %124 "perspective" +OpName %126 "perspective_centroid" +OpName %128 "perspective_sample" +OpName %130 "perspective_center" +OpName %132 "frag_main" +OpMemberDecorate %9 0 Offset 0 +OpMemberDecorate %9 1 Offset 16 +OpMemberDecorate %9 2 Offset 20 +OpMemberDecorate %9 3 Offset 24 +OpMemberDecorate %9 4 Offset 32 +OpMemberDecorate %9 5 Offset 48 +OpMemberDecorate %9 6 Offset 64 +OpMemberDecorate %9 7 Offset 80 +OpMemberDecorate %9 8 Offset 96 +OpMemberDecorate %9 9 Offset 100 +OpMemberDecorate %9 10 Offset 104 +OpDecorate %11 BuiltIn Position +OpDecorate %13 Location 0 +OpDecorate %13 Flat +OpDecorate %15 Location 2 +OpDecorate %15 Flat +OpDecorate %16 Location 3 +OpDecorate %16 NoPerspective +OpDecorate %18 Location 4 +OpDecorate %18 NoPerspective +OpDecorate %18 Centroid +OpDecorate %20 Location 6 +OpDecorate %20 NoPerspective +OpDecorate %20 Sample +OpDecorate %22 Location 7 +OpDecorate %22 NoPerspective +OpDecorate %23 Location 8 +OpDecorate %24 Location 9 +OpDecorate %24 Centroid +OpDecorate %25 Location 10 +OpDecorate %25 Sample +OpDecorate %26 Location 11 +OpDecorate %27 BuiltIn PointSize +OpDecorate %105 BuiltIn FragCoord +OpDecorate %108 Location 0 +OpDecorate %108 Flat +OpDecorate %111 Location 2 +OpDecorate %111 Flat +OpDecorate %113 Location 3 +OpDecorate %113 NoPerspective +OpDecorate %116 Location 4 +OpDecorate %116 NoPerspective +OpDecorate %116 Centroid +OpDecorate %119 Location 6 +OpDecorate %119 NoPerspective +OpDecorate %119 Sample +OpDecorate %122 Location 7 +OpDecorate %122 NoPerspective +OpDecorate %124 Location 8 +OpDecorate %126 Location 9 +OpDecorate %126 Centroid +OpDecorate %128 Location 10 +OpDecorate %128 Sample +OpDecorate %130 Location 11 %2 = OpTypeVoid -%3 = OpTypeFloat 32 -%4 = OpTypeVector %3 4 -%5 = OpTypeInt 32 0 -%6 = OpTypeVector %3 2 -%7 = OpTypeVector %3 3 -%8 = OpTypeStruct %4 %5 %5 %3 %6 %7 %7 %4 %3 %3 %3 -%11 = OpTypePointer Output %4 -%10 = OpVariable %11 Output -%13 = OpTypePointer Output %5 -%12 = OpVariable %13 Output -%14 = OpVariable %13 Output -%16 = OpTypePointer Output %3 -%15 = OpVariable %16 Output -%18 = OpTypePointer Output %6 -%17 = OpVariable %18 Output -%20 = OpTypePointer Output %7 -%19 = OpVariable %20 Output -%21 = OpVariable %20 Output -%22 = OpVariable %11 Output -%23 = OpVariable %16 Output -%24 = OpVariable %16 Output -%25 = OpVariable %16 Output -%27 = OpTypePointer Output %3 -%26 = OpVariable %27 Output -%28 = OpConstant %3 1.0 -%30 = OpTypeFunction %2 -%31 = OpConstant %3 2.0 -%32 = OpConstant %3 4.0 -%33 = OpConstant %3 5.0 -%34 = OpConstant %3 6.0 -%35 = OpConstantComposite %4 %31 %32 %33 %34 -%36 = OpConstant %5 8 -%37 = OpConstant %5 10 -%38 = OpConstant %3 27.0 -%39 = OpConstant %3 64.0 -%40 = OpConstant %3 125.0 -%41 = OpConstantComposite %6 %39 %40 -%42 = OpConstant %3 216.0 -%43 = OpConstant %3 343.0 -%44 = OpConstant %3 512.0 -%45 = OpConstantComposite %7 %42 %43 %44 -%46 = OpConstant %3 255.0 -%47 = OpConstant %3 511.0 -%48 = OpConstant %3 1024.0 -%49 = OpConstantComposite %7 %46 %47 %48 -%50 = OpConstant %3 729.0 -%51 = OpConstant %3 1000.0 -%52 = OpConstant %3 1331.0 -%53 = OpConstant %3 1728.0 -%54 = OpConstantComposite %4 %50 %51 %52 %53 -%55 = OpConstant %3 2197.0 -%56 = OpConstant %3 2744.0 -%57 = OpConstant %3 2812.0 -%59 = OpTypePointer Function %8 -%60 = OpConstantNull %8 -%62 = OpTypePointer Function %4 -%63 = OpConstant %5 0 -%65 = OpTypePointer Function %5 -%66 = OpConstant %5 1 -%68 = OpConstant %5 2 -%70 = OpTypePointer Function %3 -%71 = OpConstant %5 3 -%73 = OpTypePointer Function %6 -%74 = OpConstant %5 4 -%76 = OpTypePointer Function %7 -%77 = OpConstant %5 5 -%79 = OpConstant %5 6 -%81 = OpConstant %5 7 -%84 = OpConstant %5 9 -%105 = OpTypePointer Input %4 -%104 = OpVariable %105 Input -%108 = OpTypePointer Input %5 -%107 = OpVariable %108 Input -%110 = OpVariable %108 Input -%113 = OpTypePointer Input %3 -%112 = OpVariable %113 Input -%116 = OpTypePointer Input %6 -%115 = OpVariable %116 Input -%119 = OpTypePointer Input %7 -%118 = OpVariable %119 Input -%121 = OpVariable %119 Input -%123 = OpVariable %105 Input -%125 = OpVariable %113 Input -%127 = OpVariable %113 Input -%129 = OpVariable %113 Input -%29 = OpFunction %2 None %30 -%9 = OpLabel -%58 = OpVariable %59 Function %60 -OpStore %26 %28 -OpBranch %61 -%61 = OpLabel -%64 = OpAccessChain %62 %58 %63 -OpStore %64 %35 -%67 = OpAccessChain %65 %58 %66 -OpStore %67 %36 -%69 = OpAccessChain %65 %58 %68 -OpStore %69 %37 -%72 = OpAccessChain %70 %58 %71 -OpStore %72 %38 -%75 = OpAccessChain %73 %58 %74 -OpStore %75 %41 -%78 = OpAccessChain %76 %58 %77 -OpStore %78 %45 -%80 = OpAccessChain %76 %58 %79 -OpStore %80 %49 -%82 = OpAccessChain %62 %58 %81 -OpStore %82 %54 -%83 = OpAccessChain %70 %58 %36 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 4 +%6 = OpTypeInt 32 0 +%7 = OpTypeVector %4 2 +%8 = OpTypeVector %4 3 +%9 = OpTypeStruct %5 %6 %6 %4 %7 %8 %8 %5 %4 %4 %4 +%12 = OpTypePointer Output %5 +%11 = OpVariable %12 Output +%14 = OpTypePointer Output %6 +%13 = OpVariable %14 Output +%15 = OpVariable %14 Output +%17 = OpTypePointer Output %4 +%16 = OpVariable %17 Output +%19 = OpTypePointer Output %7 +%18 = OpVariable %19 Output +%21 = OpTypePointer Output %8 +%20 = OpVariable %21 Output +%22 = OpVariable %21 Output +%23 = OpVariable %12 Output +%24 = OpVariable %17 Output +%25 = OpVariable %17 Output +%26 = OpVariable %17 Output +%28 = OpTypePointer Output %4 +%27 = OpVariable %28 Output +%29 = OpConstant %4 1.0 +%31 = OpTypeFunction %2 +%32 = OpConstant %4 2.0 +%33 = OpConstant %4 4.0 +%34 = OpConstant %4 5.0 +%35 = OpConstant %4 6.0 +%36 = OpConstantComposite %5 %32 %33 %34 %35 +%37 = OpConstant %6 8 +%38 = OpConstant %6 10 +%39 = OpConstant %4 27.0 +%40 = OpConstant %4 64.0 +%41 = OpConstant %4 125.0 +%42 = OpConstantComposite %7 %40 %41 +%43 = OpConstant %4 216.0 +%44 = OpConstant %4 343.0 +%45 = OpConstant %4 512.0 +%46 = OpConstantComposite %8 %43 %44 %45 +%47 = OpConstant %4 255.0 +%48 = OpConstant %4 511.0 +%49 = OpConstant %4 1024.0 +%50 = OpConstantComposite %8 %47 %48 %49 +%51 = OpConstant %4 729.0 +%52 = OpConstant %4 1000.0 +%53 = OpConstant %4 1331.0 +%54 = OpConstant %4 1728.0 +%55 = OpConstantComposite %5 %51 %52 %53 %54 +%56 = OpConstant %4 2197.0 +%57 = OpConstant %4 2744.0 +%58 = OpConstant %4 2812.0 +%60 = OpTypePointer Function %9 +%61 = OpConstantNull %9 +%63 = OpTypePointer Function %5 +%64 = OpConstant %6 0 +%66 = OpTypePointer Function %6 +%67 = OpConstant %6 1 +%69 = OpConstant %6 2 +%71 = OpTypePointer Function %4 +%72 = OpConstant %6 3 +%74 = OpTypePointer Function %7 +%75 = OpConstant %6 4 +%77 = OpTypePointer Function %8 +%78 = OpConstant %6 5 +%80 = OpConstant %6 6 +%82 = OpConstant %6 7 +%85 = OpConstant %6 9 +%106 = OpTypePointer Input %5 +%105 = OpVariable %106 Input +%109 = OpTypePointer Input %6 +%108 = OpVariable %109 Input +%111 = OpVariable %109 Input +%114 = OpTypePointer Input %4 +%113 = OpVariable %114 Input +%117 = OpTypePointer Input %7 +%116 = OpVariable %117 Input +%120 = OpTypePointer Input %8 +%119 = OpVariable %120 Input +%122 = OpVariable %120 Input +%124 = OpVariable %106 Input +%126 = OpVariable %114 Input +%128 = OpVariable %114 Input +%130 = OpVariable %114 Input +%30 = OpFunction %2 None %31 +%10 = OpLabel +%59 = OpVariable %60 Function %61 +OpStore %27 %29 +OpBranch %62 +%62 = OpLabel +OpLine %3 26 4 +OpLine %3 26 19 +OpLine %3 26 4 +%65 = OpAccessChain %63 %59 %64 +OpStore %65 %36 +OpLine %3 27 4 +OpLine %3 27 4 +%68 = OpAccessChain %66 %59 %67 +OpStore %68 %37 +OpLine %3 29 4 +OpLine %3 29 4 +%70 = OpAccessChain %66 %59 %69 +OpStore %70 %38 +OpLine %3 30 4 +OpLine %3 30 4 +%73 = OpAccessChain %71 %59 %72 +OpStore %73 %39 +OpLine %3 31 4 +OpLine %3 31 26 +OpLine %3 31 4 +%76 = OpAccessChain %74 %59 %75 +OpStore %76 %42 +OpLine %3 32 4 +OpLine %3 32 24 +OpLine %3 32 4 +%79 = OpAccessChain %77 %59 %78 +OpStore %79 %46 +OpLine %3 33 4 +OpLine %3 33 24 +OpLine %3 33 4 +%81 = OpAccessChain %77 %59 %80 +OpStore %81 %50 +OpLine %3 34 4 +OpLine %3 34 22 +OpLine %3 34 4 +%83 = OpAccessChain %63 %59 %82 OpStore %83 %55 -%85 = OpAccessChain %70 %58 %84 -OpStore %85 %56 -%86 = OpAccessChain %70 %58 %37 +OpLine %3 35 4 +OpLine %3 35 4 +%84 = OpAccessChain %71 %59 %37 +OpStore %84 %56 +OpLine %3 36 4 +OpLine %3 36 4 +%86 = OpAccessChain %71 %59 %85 OpStore %86 %57 -%87 = OpLoad %8 %58 -%88 = OpCompositeExtract %4 %87 0 -OpStore %10 %88 -%89 = OpAccessChain %27 %10 %66 -%90 = OpLoad %3 %89 -%91 = OpFNegate %3 %90 -OpStore %89 %91 -%92 = OpCompositeExtract %5 %87 1 -OpStore %12 %92 -%93 = OpCompositeExtract %5 %87 2 -OpStore %14 %93 -%94 = OpCompositeExtract %3 %87 3 +OpLine %3 37 4 +OpLine %3 37 4 +%87 = OpAccessChain %71 %59 %38 +OpStore %87 %58 +OpLine %3 1 1 +%88 = OpLoad %9 %59 +%89 = OpCompositeExtract %5 %88 0 +OpStore %11 %89 +%90 = OpAccessChain %28 %11 %67 +%91 = OpLoad %4 %90 +%92 = OpFNegate %4 %91 +OpStore %90 %92 +%93 = OpCompositeExtract %6 %88 1 +OpStore %13 %93 +%94 = OpCompositeExtract %6 %88 2 OpStore %15 %94 -%95 = OpCompositeExtract %6 %87 4 -OpStore %17 %95 -%96 = OpCompositeExtract %7 %87 5 -OpStore %19 %96 -%97 = OpCompositeExtract %7 %87 6 -OpStore %21 %97 -%98 = OpCompositeExtract %4 %87 7 +%95 = OpCompositeExtract %4 %88 3 +OpStore %16 %95 +%96 = OpCompositeExtract %7 %88 4 +OpStore %18 %96 +%97 = OpCompositeExtract %8 %88 5 +OpStore %20 %97 +%98 = OpCompositeExtract %8 %88 6 OpStore %22 %98 -%99 = OpCompositeExtract %3 %87 8 +%99 = OpCompositeExtract %5 %88 7 OpStore %23 %99 -%100 = OpCompositeExtract %3 %87 9 +%100 = OpCompositeExtract %4 %88 8 OpStore %24 %100 -%101 = OpCompositeExtract %3 %87 10 +%101 = OpCompositeExtract %4 %88 9 OpStore %25 %101 +%102 = OpCompositeExtract %4 %88 10 +OpStore %26 %102 OpReturn OpFunctionEnd -%131 = OpFunction %2 None %30 -%102 = OpLabel -%106 = OpLoad %4 %104 -%109 = OpLoad %5 %107 -%111 = OpLoad %5 %110 -%114 = OpLoad %3 %112 -%117 = OpLoad %6 %115 -%120 = OpLoad %7 %118 -%122 = OpLoad %7 %121 -%124 = OpLoad %4 %123 -%126 = OpLoad %3 %125 -%128 = OpLoad %3 %127 -%130 = OpLoad %3 %129 -%103 = OpCompositeConstruct %8 %106 %109 %111 %114 %117 %120 %122 %124 %126 %128 %130 -OpBranch %132 -%132 = OpLabel +%132 = OpFunction %2 None %31 +%103 = OpLabel +%107 = OpLoad %5 %105 +%110 = OpLoad %6 %108 +%112 = OpLoad %6 %111 +%115 = OpLoad %4 %113 +%118 = OpLoad %7 %116 +%121 = OpLoad %8 %119 +%123 = OpLoad %8 %122 +%125 = OpLoad %5 %124 +%127 = OpLoad %4 %126 +%129 = OpLoad %4 %128 +%131 = OpLoad %4 %130 +%104 = OpCompositeConstruct %9 %107 %110 %112 %115 %118 %121 %123 %125 %127 %129 %131 +OpBranch %133 +%133 = OpLabel OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/padding.spvasm b/naga/tests/out/spv/padding.spvasm index b7b21f17ed..2df29c96d4 100644 --- a/naga/tests/out/spv/padding.spvasm +++ b/naga/tests/out/spv/padding.spvasm @@ -1,97 +1,136 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 49 +; Bound: 50 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %26 "vertex" %24 -OpMemberName %5 0 "a" -OpName %5 "S" +OpEntryPoint Vertex %27 "vertex" %25 +%3 = OpString "padding.wgsl" +OpSource Unknown 0 %3 "struct S { + a: vec3, +} + +struct Test { + a: S, + b: f32, // offset: 16 +} + +struct Test2 { + a: array, 2>, + b: f32, // offset: 32 +} + +struct Test3 { + a: mat4x3, + b: f32, // offset: 64 +} + +@group(0) @binding(0) +var input1: Test; + +@group(0) @binding(1) +var input2: Test2; + +@group(0) @binding(2) +var input3: Test3; + + +@vertex +fn vertex() -> @builtin(position) vec4 { + return vec4(1.0) * input1.b * input2.b * input3.b; +} +" OpMemberName %6 0 "a" -OpMemberName %6 1 "b" -OpName %6 "Test" -OpMemberName %10 0 "a" -OpMemberName %10 1 "b" -OpName %10 "Test2" -OpMemberName %12 0 "a" -OpMemberName %12 1 "b" -OpName %12 "Test3" -OpName %14 "input1" -OpName %17 "input2" -OpName %20 "input3" -OpName %26 "vertex" -OpMemberDecorate %5 0 Offset 0 +OpName %6 "S" +OpMemberName %7 0 "a" +OpMemberName %7 1 "b" +OpName %7 "Test" +OpMemberName %11 0 "a" +OpMemberName %11 1 "b" +OpName %11 "Test2" +OpMemberName %13 0 "a" +OpMemberName %13 1 "b" +OpName %13 "Test3" +OpName %15 "input1" +OpName %18 "input2" +OpName %21 "input3" +OpName %27 "vertex" OpMemberDecorate %6 0 Offset 0 -OpMemberDecorate %6 1 Offset 16 -OpDecorate %7 ArrayStride 16 -OpMemberDecorate %10 0 Offset 0 -OpMemberDecorate %10 1 Offset 32 -OpMemberDecorate %12 0 Offset 0 -OpMemberDecorate %12 0 ColMajor -OpMemberDecorate %12 0 MatrixStride 16 -OpMemberDecorate %12 1 Offset 64 -OpDecorate %14 DescriptorSet 0 -OpDecorate %14 Binding 0 -OpDecorate %15 Block -OpMemberDecorate %15 0 Offset 0 -OpDecorate %17 DescriptorSet 0 -OpDecorate %17 Binding 1 -OpDecorate %18 Block -OpMemberDecorate %18 0 Offset 0 -OpDecorate %20 DescriptorSet 0 -OpDecorate %20 Binding 2 -OpDecorate %21 Block -OpMemberDecorate %21 0 Offset 0 -OpDecorate %24 BuiltIn Position +OpMemberDecorate %7 0 Offset 0 +OpMemberDecorate %7 1 Offset 16 +OpDecorate %8 ArrayStride 16 +OpMemberDecorate %11 0 Offset 0 +OpMemberDecorate %11 1 Offset 32 +OpMemberDecorate %13 0 Offset 0 +OpMemberDecorate %13 0 ColMajor +OpMemberDecorate %13 0 MatrixStride 16 +OpMemberDecorate %13 1 Offset 64 +OpDecorate %15 DescriptorSet 0 +OpDecorate %15 Binding 0 +OpDecorate %16 Block +OpMemberDecorate %16 0 Offset 0 +OpDecorate %18 DescriptorSet 0 +OpDecorate %18 Binding 1 +OpDecorate %19 Block +OpMemberDecorate %19 0 Offset 0 +OpDecorate %21 DescriptorSet 0 +OpDecorate %21 Binding 2 +OpDecorate %22 Block +OpMemberDecorate %22 0 Offset 0 +OpDecorate %25 BuiltIn Position %2 = OpTypeVoid -%3 = OpTypeFloat 32 -%4 = OpTypeVector %3 3 -%5 = OpTypeStruct %4 -%6 = OpTypeStruct %5 %3 -%9 = OpTypeInt 32 0 -%8 = OpConstant %9 2 -%7 = OpTypeArray %4 %8 -%10 = OpTypeStruct %7 %3 -%11 = OpTypeMatrix %4 4 -%12 = OpTypeStruct %11 %3 -%13 = OpTypeVector %3 4 -%15 = OpTypeStruct %6 -%16 = OpTypePointer Uniform %15 -%14 = OpVariable %16 Uniform -%18 = OpTypeStruct %10 -%19 = OpTypePointer Uniform %18 -%17 = OpVariable %19 Uniform -%21 = OpTypeStruct %12 -%22 = OpTypePointer Uniform %21 -%20 = OpVariable %22 Uniform -%25 = OpTypePointer Output %13 -%24 = OpVariable %25 Output -%27 = OpTypeFunction %2 -%28 = OpTypePointer Uniform %6 -%29 = OpConstant %9 0 -%31 = OpTypePointer Uniform %10 -%33 = OpTypePointer Uniform %12 -%35 = OpConstant %3 1.0 -%36 = OpConstantComposite %13 %35 %35 %35 %35 -%38 = OpTypePointer Uniform %3 -%39 = OpConstant %9 1 -%26 = OpFunction %2 None %27 -%23 = OpLabel -%30 = OpAccessChain %28 %14 %29 -%32 = OpAccessChain %31 %17 %29 -%34 = OpAccessChain %33 %20 %29 -OpBranch %37 -%37 = OpLabel -%40 = OpAccessChain %38 %30 %39 -%41 = OpLoad %3 %40 -%42 = OpVectorTimesScalar %13 %36 %41 -%43 = OpAccessChain %38 %32 %39 -%44 = OpLoad %3 %43 -%45 = OpVectorTimesScalar %13 %42 %44 -%46 = OpAccessChain %38 %34 %39 -%47 = OpLoad %3 %46 -%48 = OpVectorTimesScalar %13 %45 %47 -OpStore %24 %48 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 3 +%6 = OpTypeStruct %5 +%7 = OpTypeStruct %6 %4 +%10 = OpTypeInt 32 0 +%9 = OpConstant %10 2 +%8 = OpTypeArray %5 %9 +%11 = OpTypeStruct %8 %4 +%12 = OpTypeMatrix %5 4 +%13 = OpTypeStruct %12 %4 +%14 = OpTypeVector %4 4 +%16 = OpTypeStruct %7 +%17 = OpTypePointer Uniform %16 +%15 = OpVariable %17 Uniform +%19 = OpTypeStruct %11 +%20 = OpTypePointer Uniform %19 +%18 = OpVariable %20 Uniform +%22 = OpTypeStruct %13 +%23 = OpTypePointer Uniform %22 +%21 = OpVariable %23 Uniform +%26 = OpTypePointer Output %14 +%25 = OpVariable %26 Output +%28 = OpTypeFunction %2 +%29 = OpTypePointer Uniform %7 +%30 = OpConstant %10 0 +%32 = OpTypePointer Uniform %11 +%34 = OpTypePointer Uniform %13 +%36 = OpConstant %4 1.0 +%37 = OpConstantComposite %14 %36 %36 %36 %36 +%39 = OpTypePointer Uniform %4 +%40 = OpConstant %10 1 +%27 = OpFunction %2 None %28 +%24 = OpLabel +%31 = OpAccessChain %29 %15 %30 +%33 = OpAccessChain %32 %18 %30 +%35 = OpAccessChain %34 %21 %30 +OpBranch %38 +%38 = OpLabel +OpLine %3 32 12 +OpLine %3 32 12 +%41 = OpAccessChain %39 %31 %40 +%42 = OpLoad %4 %41 +%43 = OpVectorTimesScalar %14 %37 %42 +OpLine %3 32 12 +%44 = OpAccessChain %39 %33 %40 +%45 = OpLoad %4 %44 +%46 = OpVectorTimesScalar %14 %43 %45 +OpLine %3 32 12 +%47 = OpAccessChain %39 %35 %40 +%48 = OpLoad %4 %47 +%49 = OpVectorTimesScalar %14 %46 %48 +OpStore %25 %49 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/pointers.spvasm b/naga/tests/out/spv/pointers.spvasm index 07658a21a1..6e69069c8e 100644 --- a/naga/tests/out/spv/pointers.spvasm +++ b/naga/tests/out/spv/pointers.spvasm @@ -1,77 +1,114 @@ ; SPIR-V ; Version: 1.2 ; Generator: rspirv -; Bound: 42 +; Bound: 43 OpCapability Shader OpCapability Linkage OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpMemberName %7 0 "arr" -OpName %7 "DynamicArray" -OpName %8 "dynamic_array" -OpName %11 "f" -OpName %14 "v" -OpName %22 "i" -OpName %23 "v" -OpName %24 "index_unsized" -OpName %34 "i" -OpName %35 "v" -OpName %36 "index_dynamic_array" -OpDecorate %6 ArrayStride 4 -OpMemberDecorate %7 0 Offset 0 -OpDecorate %7 Block -OpDecorate %8 DescriptorSet 0 -OpDecorate %8 Binding 0 +%3 = OpString "pointers.wgsl" +OpSource Unknown 0 %3 "fn f() { + var v: vec2; + let px = &v.x; + *px = 10; +} + +struct DynamicArray { + arr: array +} + +@group(0) @binding(0) +var dynamic_array: DynamicArray; + +fn index_unsized(i: i32, v: u32) { + let p: ptr = &dynamic_array; + + let val = (*p).arr[i]; + (*p).arr[i] = val + v; +} + +fn index_dynamic_array(i: i32, v: u32) { + let p: ptr, read_write> = &dynamic_array.arr; + + let val = (*p)[i]; + (*p)[i] = val + v; +} +" +OpMemberName %8 0 "arr" +OpName %8 "DynamicArray" +OpName %9 "dynamic_array" +OpName %12 "f" +OpName %15 "v" +OpName %23 "i" +OpName %24 "v" +OpName %25 "index_unsized" +OpName %35 "i" +OpName %36 "v" +OpName %37 "index_dynamic_array" +OpDecorate %7 ArrayStride 4 +OpMemberDecorate %8 0 Offset 0 +OpDecorate %8 Block +OpDecorate %9 DescriptorSet 0 +OpDecorate %9 Binding 0 %2 = OpTypeVoid -%3 = OpTypeInt 32 1 -%4 = OpTypeVector %3 2 -%5 = OpTypeInt 32 0 -%6 = OpTypeRuntimeArray %5 -%7 = OpTypeStruct %6 -%9 = OpTypePointer StorageBuffer %7 -%8 = OpVariable %9 StorageBuffer -%12 = OpTypeFunction %2 -%13 = OpConstant %3 10 -%15 = OpTypePointer Function %4 -%16 = OpConstantNull %4 -%18 = OpTypePointer Function %3 -%19 = OpConstant %5 0 -%25 = OpTypeFunction %2 %3 %5 -%27 = OpTypePointer StorageBuffer %6 -%28 = OpTypePointer StorageBuffer %5 -%11 = OpFunction %2 None %12 -%10 = OpLabel -%14 = OpVariable %15 Function %16 -OpBranch %17 -%17 = OpLabel -%20 = OpAccessChain %18 %14 %19 -OpStore %20 %13 +%4 = OpTypeInt 32 1 +%5 = OpTypeVector %4 2 +%6 = OpTypeInt 32 0 +%7 = OpTypeRuntimeArray %6 +%8 = OpTypeStruct %7 +%10 = OpTypePointer StorageBuffer %8 +%9 = OpVariable %10 StorageBuffer +%13 = OpTypeFunction %2 +%14 = OpConstant %4 10 +%16 = OpTypePointer Function %5 +%17 = OpConstantNull %5 +%19 = OpTypePointer Function %4 +%20 = OpConstant %6 0 +%26 = OpTypeFunction %2 %4 %6 +%28 = OpTypePointer StorageBuffer %7 +%29 = OpTypePointer StorageBuffer %6 +%12 = OpFunction %2 None %13 +%11 = OpLabel +%15 = OpVariable %16 Function %17 +OpBranch %18 +%18 = OpLabel +OpLine %3 3 14 +OpLine %3 4 4 +%21 = OpAccessChain %19 %15 %20 +OpStore %21 %14 OpReturn OpFunctionEnd -%24 = OpFunction %2 None %25 -%22 = OpFunctionParameter %3 -%23 = OpFunctionParameter %5 -%21 = OpLabel -OpBranch %26 -%26 = OpLabel -%29 = OpAccessChain %28 %8 %19 %22 -%30 = OpLoad %5 %29 -%31 = OpIAdd %5 %30 %23 -%32 = OpAccessChain %28 %8 %19 %22 -OpStore %32 %31 +%25 = OpFunction %2 None %26 +%23 = OpFunctionParameter %4 +%24 = OpFunctionParameter %6 +%22 = OpLabel +OpBranch %27 +%27 = OpLabel +OpLine %3 17 14 +%30 = OpAccessChain %29 %9 %20 %23 +%31 = OpLoad %6 %30 +OpLine %3 18 4 +%32 = OpIAdd %6 %31 %24 +OpLine %3 18 4 +%33 = OpAccessChain %29 %9 %20 %23 +OpStore %33 %32 OpReturn OpFunctionEnd -%36 = OpFunction %2 None %25 -%34 = OpFunctionParameter %3 -%35 = OpFunctionParameter %5 -%33 = OpLabel -OpBranch %37 -%37 = OpLabel -%38 = OpAccessChain %28 %8 %19 %34 -%39 = OpLoad %5 %38 -%40 = OpIAdd %5 %39 %35 -%41 = OpAccessChain %28 %8 %19 %34 -OpStore %41 %40 +%37 = OpFunction %2 None %26 +%35 = OpFunctionParameter %4 +%36 = OpFunctionParameter %6 +%34 = OpLabel +OpBranch %38 +%38 = OpLabel +OpLine %3 22 51 +OpLine %3 24 14 +%39 = OpAccessChain %29 %9 %20 %35 +%40 = OpLoad %6 %39 +OpLine %3 25 4 +%41 = OpIAdd %6 %40 %36 +OpLine %3 25 4 +%42 = OpAccessChain %29 %9 %20 %35 +OpStore %42 %41 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/policy-mix.spvasm b/naga/tests/out/spv/policy-mix.spvasm index f517777987..200a164227 100644 --- a/naga/tests/out/spv/policy-mix.spvasm +++ b/naga/tests/out/spv/policy-mix.spvasm @@ -1,147 +1,189 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 100 +; Bound: 101 OpCapability Shader OpCapability ImageQuery OpCapability Linkage OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpMemberName %8 0 "a" -OpName %8 "InStorage" -OpMemberName %11 0 "a" -OpName %11 "InUniform" -OpName %21 "in_storage" -OpName %24 "in_uniform" -OpName %27 "image_2d_array" -OpName %29 "in_workgroup" -OpName %31 "in_private" -OpName %35 "c" -OpName %36 "i" -OpName %37 "l" -OpName %38 "mock_function" -OpName %52 "in_function" -OpDecorate %5 ArrayStride 16 -OpMemberDecorate %8 0 Offset 0 -OpDecorate %9 ArrayStride 16 -OpMemberDecorate %11 0 Offset 0 -OpDecorate %13 ArrayStride 4 -OpDecorate %15 ArrayStride 4 -OpDecorate %19 ArrayStride 16 -OpDecorate %21 NonWritable -OpDecorate %21 DescriptorSet 0 -OpDecorate %21 Binding 0 -OpDecorate %22 Block -OpMemberDecorate %22 0 Offset 0 -OpDecorate %24 DescriptorSet 0 -OpDecorate %24 Binding 1 -OpDecorate %25 Block -OpMemberDecorate %25 0 Offset 0 -OpDecorate %27 DescriptorSet 0 -OpDecorate %27 Binding 2 +%3 = OpString "policy-mix.wgsl" +OpSource Unknown 0 %3 "// Tests that the index, buffer, and texture bounds checks policies are +// implemented separately. + +// Storage and Uniform storage classes +struct InStorage { + a: array, 10> +} +@group(0) @binding(0) var in_storage: InStorage; + +struct InUniform { + a: array, 20> +} +@group(0) @binding(1) var in_uniform: InUniform; + +// Textures automatically land in the `handle` storage class. +@group(0) @binding(2) var image_2d_array: texture_2d_array; + +// None of the above. +var in_workgroup: array; +var in_private: array; + +fn mock_function(c: vec2, i: i32, l: i32) -> vec4 { + var in_function: array, 2> = + array, 2>(vec4(0.707, 0.0, 0.0, 1.0), + vec4(0.0, 0.707, 0.0, 1.0)); + + return (in_storage.a[i] + + in_uniform.a[i] + + textureLoad(image_2d_array, c, i, l) + + in_workgroup[i] + + in_private[i] + + in_function[i]); +} +" +OpMemberName %9 0 "a" +OpName %9 "InStorage" +OpMemberName %12 0 "a" +OpName %12 "InUniform" +OpName %22 "in_storage" +OpName %25 "in_uniform" +OpName %28 "image_2d_array" +OpName %30 "in_workgroup" +OpName %32 "in_private" +OpName %36 "c" +OpName %37 "i" +OpName %38 "l" +OpName %39 "mock_function" +OpName %53 "in_function" +OpDecorate %6 ArrayStride 16 +OpMemberDecorate %9 0 Offset 0 +OpDecorate %10 ArrayStride 16 +OpMemberDecorate %12 0 Offset 0 +OpDecorate %14 ArrayStride 4 +OpDecorate %16 ArrayStride 4 +OpDecorate %20 ArrayStride 16 +OpDecorate %22 NonWritable +OpDecorate %22 DescriptorSet 0 +OpDecorate %22 Binding 0 +OpDecorate %23 Block +OpMemberDecorate %23 0 Offset 0 +OpDecorate %25 DescriptorSet 0 +OpDecorate %25 Binding 1 +OpDecorate %26 Block +OpMemberDecorate %26 0 Offset 0 +OpDecorate %28 DescriptorSet 0 +OpDecorate %28 Binding 2 %2 = OpTypeVoid -%3 = OpTypeFloat 32 -%4 = OpTypeVector %3 4 -%7 = OpTypeInt 32 0 -%6 = OpConstant %7 10 -%5 = OpTypeArray %4 %6 -%8 = OpTypeStruct %5 -%10 = OpConstant %7 20 -%9 = OpTypeArray %4 %10 -%11 = OpTypeStruct %9 -%12 = OpTypeImage %3 2D 0 1 0 1 Unknown -%14 = OpConstant %7 30 -%13 = OpTypeArray %3 %14 -%16 = OpConstant %7 40 -%15 = OpTypeArray %3 %16 -%17 = OpTypeInt 32 1 -%18 = OpTypeVector %17 2 -%20 = OpConstant %7 2 -%19 = OpTypeArray %4 %20 -%22 = OpTypeStruct %8 -%23 = OpTypePointer StorageBuffer %22 -%21 = OpVariable %23 StorageBuffer -%25 = OpTypeStruct %11 -%26 = OpTypePointer Uniform %25 -%24 = OpVariable %26 Uniform -%28 = OpTypePointer UniformConstant %12 -%27 = OpVariable %28 UniformConstant -%30 = OpTypePointer Workgroup %13 -%29 = OpVariable %30 Workgroup -%32 = OpTypePointer Private %15 -%33 = OpConstantNull %15 -%31 = OpVariable %32 Private %33 -%39 = OpTypeFunction %4 %18 %17 %17 -%40 = OpTypePointer StorageBuffer %8 -%41 = OpConstant %7 0 -%43 = OpTypePointer Uniform %11 -%46 = OpConstant %3 0.707 -%47 = OpConstant %3 0.0 -%48 = OpConstant %3 1.0 -%49 = OpConstantComposite %4 %46 %47 %47 %48 -%50 = OpConstantComposite %4 %47 %46 %47 %48 -%51 = OpConstantComposite %19 %49 %50 -%53 = OpTypePointer Function %19 -%55 = OpTypePointer StorageBuffer %5 -%56 = OpTypePointer StorageBuffer %4 -%59 = OpTypePointer Uniform %9 -%60 = OpTypePointer Uniform %4 -%64 = OpTypeVector %17 3 -%66 = OpTypeBool -%67 = OpConstantNull %4 -%73 = OpTypeVector %66 3 -%80 = OpTypePointer Workgroup %3 -%81 = OpConstant %7 29 -%87 = OpTypePointer Private %3 -%88 = OpConstant %7 39 -%94 = OpTypePointer Function %4 -%95 = OpConstant %7 1 -%38 = OpFunction %4 None %39 -%35 = OpFunctionParameter %18 -%36 = OpFunctionParameter %17 -%37 = OpFunctionParameter %17 -%34 = OpLabel -%52 = OpVariable %53 Function %51 -%42 = OpAccessChain %40 %21 %41 -%44 = OpAccessChain %43 %24 %41 -%45 = OpLoad %12 %27 -OpBranch %54 -%54 = OpLabel -%57 = OpAccessChain %56 %42 %41 %36 -%58 = OpLoad %4 %57 -%61 = OpAccessChain %60 %44 %41 %36 -%62 = OpLoad %4 %61 -%63 = OpFAdd %4 %58 %62 -%65 = OpCompositeConstruct %64 %35 %36 -%68 = OpImageQueryLevels %17 %45 -%69 = OpULessThan %66 %37 %68 -OpSelectionMerge %70 None -OpBranchConditional %69 %71 %70 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 4 +%8 = OpTypeInt 32 0 +%7 = OpConstant %8 10 +%6 = OpTypeArray %5 %7 +%9 = OpTypeStruct %6 +%11 = OpConstant %8 20 +%10 = OpTypeArray %5 %11 +%12 = OpTypeStruct %10 +%13 = OpTypeImage %4 2D 0 1 0 1 Unknown +%15 = OpConstant %8 30 +%14 = OpTypeArray %4 %15 +%17 = OpConstant %8 40 +%16 = OpTypeArray %4 %17 +%18 = OpTypeInt 32 1 +%19 = OpTypeVector %18 2 +%21 = OpConstant %8 2 +%20 = OpTypeArray %5 %21 +%23 = OpTypeStruct %9 +%24 = OpTypePointer StorageBuffer %23 +%22 = OpVariable %24 StorageBuffer +%26 = OpTypeStruct %12 +%27 = OpTypePointer Uniform %26 +%25 = OpVariable %27 Uniform +%29 = OpTypePointer UniformConstant %13 +%28 = OpVariable %29 UniformConstant +%31 = OpTypePointer Workgroup %14 +%30 = OpVariable %31 Workgroup +%33 = OpTypePointer Private %16 +%34 = OpConstantNull %16 +%32 = OpVariable %33 Private %34 +%40 = OpTypeFunction %5 %19 %18 %18 +%41 = OpTypePointer StorageBuffer %9 +%42 = OpConstant %8 0 +%44 = OpTypePointer Uniform %12 +%47 = OpConstant %4 0.707 +%48 = OpConstant %4 0.0 +%49 = OpConstant %4 1.0 +%50 = OpConstantComposite %5 %47 %48 %48 %49 +%51 = OpConstantComposite %5 %48 %47 %48 %49 +%52 = OpConstantComposite %20 %50 %51 +%54 = OpTypePointer Function %20 +%56 = OpTypePointer StorageBuffer %6 +%57 = OpTypePointer StorageBuffer %5 +%60 = OpTypePointer Uniform %10 +%61 = OpTypePointer Uniform %5 +%65 = OpTypeVector %18 3 +%67 = OpTypeBool +%68 = OpConstantNull %5 +%74 = OpTypeVector %67 3 +%81 = OpTypePointer Workgroup %4 +%82 = OpConstant %8 29 +%88 = OpTypePointer Private %4 +%89 = OpConstant %8 39 +%95 = OpTypePointer Function %5 +%96 = OpConstant %8 1 +%39 = OpFunction %5 None %40 +%36 = OpFunctionParameter %19 +%37 = OpFunctionParameter %18 +%38 = OpFunctionParameter %18 +%35 = OpLabel +%53 = OpVariable %54 Function %52 +%43 = OpAccessChain %41 %22 %42 +%45 = OpAccessChain %44 %25 %42 +%46 = OpLoad %13 %28 +OpBranch %55 +%55 = OpLabel +OpLine %3 24 25 +OpLine %3 24 5 +OpLine %3 27 11 +%58 = OpAccessChain %57 %43 %42 %37 +%59 = OpLoad %5 %58 +OpLine %3 27 11 +%62 = OpAccessChain %61 %45 %42 %37 +%63 = OpLoad %5 %62 +%64 = OpFAdd %5 %59 %63 +OpLine %3 27 11 +%66 = OpCompositeConstruct %65 %36 %37 +%69 = OpImageQueryLevels %18 %46 +%70 = OpULessThan %67 %38 %69 +OpSelectionMerge %71 None +OpBranchConditional %70 %72 %71 +%72 = OpLabel +%73 = OpImageQuerySizeLod %65 %46 %38 +%75 = OpULessThan %74 %66 %73 +%76 = OpAll %67 %75 +OpBranchConditional %76 %77 %71 +%77 = OpLabel +%78 = OpImageFetch %5 %46 %66 Lod %38 +OpBranch %71 %71 = OpLabel -%72 = OpImageQuerySizeLod %64 %45 %37 -%74 = OpULessThan %73 %65 %72 -%75 = OpAll %66 %74 -OpBranchConditional %75 %76 %70 -%76 = OpLabel -%77 = OpImageFetch %4 %45 %65 Lod %37 -OpBranch %70 -%70 = OpLabel -%78 = OpPhi %4 %67 %54 %67 %71 %77 %76 -%79 = OpFAdd %4 %63 %78 -%82 = OpExtInst %7 %1 UMin %36 %81 -%83 = OpAccessChain %80 %29 %82 -%84 = OpLoad %3 %83 -%85 = OpCompositeConstruct %4 %84 %84 %84 %84 -%86 = OpFAdd %4 %79 %85 -%89 = OpExtInst %7 %1 UMin %36 %88 -%90 = OpAccessChain %87 %31 %89 -%91 = OpLoad %3 %90 -%92 = OpCompositeConstruct %4 %91 %91 %91 %91 -%93 = OpFAdd %4 %86 %92 -%96 = OpExtInst %7 %1 UMin %36 %95 -%97 = OpAccessChain %94 %52 %96 -%98 = OpLoad %4 %97 -%99 = OpFAdd %4 %93 %98 -OpReturnValue %99 +%79 = OpPhi %5 %68 %55 %68 %72 %78 %77 +%80 = OpFAdd %5 %64 %79 +OpLine %3 27 11 +%83 = OpExtInst %8 %1 UMin %37 %82 +%84 = OpAccessChain %81 %30 %83 +%85 = OpLoad %4 %84 +%86 = OpCompositeConstruct %5 %85 %85 %85 %85 +%87 = OpFAdd %5 %80 %86 +OpLine %3 27 11 +%90 = OpExtInst %8 %1 UMin %37 %89 +%91 = OpAccessChain %88 %32 %90 +%92 = OpLoad %4 %91 +%93 = OpCompositeConstruct %5 %92 %92 %92 %92 +%94 = OpFAdd %5 %87 %93 +%97 = OpExtInst %8 %1 UMin %37 %96 +%98 = OpAccessChain %95 %53 %97 +%99 = OpLoad %5 %98 +%100 = OpFAdd %5 %94 %99 +OpReturnValue %100 OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/quad.spvasm b/naga/tests/out/spv/quad.spvasm index b77ed65e07..a3532fb16e 100644 --- a/naga/tests/out/spv/quad.spvasm +++ b/naga/tests/out/spv/quad.spvasm @@ -1,118 +1,166 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 64 +; Bound: 65 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %24 "vert_main" %15 %18 %20 %22 -OpEntryPoint Fragment %44 "frag_main" %41 %43 -OpEntryPoint Fragment %60 "fs_extra" %59 -OpExecutionMode %44 OriginUpperLeft -OpExecutionMode %60 OriginUpperLeft -OpMemberName %6 0 "uv" -OpMemberName %6 1 "position" -OpName %6 "VertexOutput" -OpName %9 "c_scale" -OpName %10 "u_texture" -OpName %12 "u_sampler" -OpName %15 "pos" -OpName %18 "uv" -OpName %20 "uv" -OpName %22 "position" -OpName %24 "vert_main" -OpName %41 "uv" -OpName %44 "frag_main" -OpName %60 "fs_extra" -OpMemberDecorate %6 0 Offset 0 -OpMemberDecorate %6 1 Offset 16 -OpDecorate %10 DescriptorSet 0 -OpDecorate %10 Binding 0 -OpDecorate %12 DescriptorSet 0 -OpDecorate %12 Binding 1 -OpDecorate %15 Location 0 -OpDecorate %18 Location 1 -OpDecorate %20 Location 0 -OpDecorate %22 BuiltIn Position -OpDecorate %41 Location 0 -OpDecorate %43 Location 0 -OpDecorate %59 Location 0 +OpEntryPoint Vertex %25 "vert_main" %16 %19 %21 %23 +OpEntryPoint Fragment %45 "frag_main" %42 %44 +OpEntryPoint Fragment %61 "fs_extra" %60 +OpExecutionMode %45 OriginUpperLeft +OpExecutionMode %61 OriginUpperLeft +%3 = OpString "quad.wgsl" +OpSource Unknown 0 %3 "// vertex +const c_scale: f32 = 1.2; + +struct VertexOutput { + @location(0) uv : vec2, + @builtin(position) position : vec4, +} + +@vertex +fn vert_main( + @location(0) pos : vec2, + @location(1) uv : vec2, +) -> VertexOutput { + return VertexOutput(uv, vec4(c_scale * pos, 0.0, 1.0)); +} + +// fragment +@group(0) @binding(0) var u_texture : texture_2d; +@group(0) @binding(1) var u_sampler : sampler; + +@fragment +fn frag_main(@location(0) uv : vec2) -> @location(0) vec4 { + let color = textureSample(u_texture, u_sampler, uv); + if color.a == 0.0 { + discard; + } + // forcing the expression here to be emitted in order to check the + // uniformity of the control flow a bit more strongly. + let premultiplied = color.a * color; + return premultiplied; +} + + +// We need to make sure that backends are successfully handling multiple entry points for the same shader stage. +@fragment +fn fs_extra() -> @location(0) vec4 { + return vec4(0.0, 0.5, 0.0, 0.5); +} +" +OpMemberName %7 0 "uv" +OpMemberName %7 1 "position" +OpName %7 "VertexOutput" +OpName %10 "c_scale" +OpName %11 "u_texture" +OpName %13 "u_sampler" +OpName %16 "pos" +OpName %19 "uv" +OpName %21 "uv" +OpName %23 "position" +OpName %25 "vert_main" +OpName %42 "uv" +OpName %45 "frag_main" +OpName %61 "fs_extra" +OpMemberDecorate %7 0 Offset 0 +OpMemberDecorate %7 1 Offset 16 +OpDecorate %11 DescriptorSet 0 +OpDecorate %11 Binding 0 +OpDecorate %13 DescriptorSet 0 +OpDecorate %13 Binding 1 +OpDecorate %16 Location 0 +OpDecorate %19 Location 1 +OpDecorate %21 Location 0 +OpDecorate %23 BuiltIn Position +OpDecorate %42 Location 0 +OpDecorate %44 Location 0 +OpDecorate %60 Location 0 %2 = OpTypeVoid -%3 = OpTypeFloat 32 -%4 = OpTypeVector %3 2 -%5 = OpTypeVector %3 4 -%6 = OpTypeStruct %4 %5 -%7 = OpTypeImage %3 2D 0 0 0 1 Unknown -%8 = OpTypeSampler -%9 = OpConstant %3 1.2 -%11 = OpTypePointer UniformConstant %7 -%10 = OpVariable %11 UniformConstant -%13 = OpTypePointer UniformConstant %8 -%12 = OpVariable %13 UniformConstant -%16 = OpTypePointer Input %4 -%15 = OpVariable %16 Input -%18 = OpVariable %16 Input -%21 = OpTypePointer Output %4 -%20 = OpVariable %21 Output -%23 = OpTypePointer Output %5 -%22 = OpVariable %23 Output -%25 = OpTypeFunction %2 -%26 = OpConstant %3 0.0 -%27 = OpConstant %3 1.0 -%34 = OpTypePointer Output %3 -%36 = OpTypeInt 32 0 -%35 = OpConstant %36 1 -%41 = OpVariable %16 Input -%43 = OpVariable %23 Output -%48 = OpTypeSampledImage %7 -%52 = OpTypeBool -%59 = OpVariable %23 Output -%61 = OpConstant %3 0.5 -%62 = OpConstantComposite %5 %26 %61 %26 %61 -%24 = OpFunction %2 None %25 -%14 = OpLabel -%17 = OpLoad %4 %15 -%19 = OpLoad %4 %18 -OpBranch %28 -%28 = OpLabel -%29 = OpVectorTimesScalar %4 %17 %9 -%30 = OpCompositeConstruct %5 %29 %26 %27 -%31 = OpCompositeConstruct %6 %19 %30 -%32 = OpCompositeExtract %4 %31 0 -OpStore %20 %32 -%33 = OpCompositeExtract %5 %31 1 -OpStore %22 %33 -%37 = OpAccessChain %34 %22 %35 -%38 = OpLoad %3 %37 -%39 = OpFNegate %3 %38 -OpStore %37 %39 +%4 = OpTypeFloat 32 +%5 = OpTypeVector %4 2 +%6 = OpTypeVector %4 4 +%7 = OpTypeStruct %5 %6 +%8 = OpTypeImage %4 2D 0 0 0 1 Unknown +%9 = OpTypeSampler +%10 = OpConstant %4 1.2 +%12 = OpTypePointer UniformConstant %8 +%11 = OpVariable %12 UniformConstant +%14 = OpTypePointer UniformConstant %9 +%13 = OpVariable %14 UniformConstant +%17 = OpTypePointer Input %5 +%16 = OpVariable %17 Input +%19 = OpVariable %17 Input +%22 = OpTypePointer Output %5 +%21 = OpVariable %22 Output +%24 = OpTypePointer Output %6 +%23 = OpVariable %24 Output +%26 = OpTypeFunction %2 +%27 = OpConstant %4 0.0 +%28 = OpConstant %4 1.0 +%35 = OpTypePointer Output %4 +%37 = OpTypeInt 32 0 +%36 = OpConstant %37 1 +%42 = OpVariable %17 Input +%44 = OpVariable %24 Output +%49 = OpTypeSampledImage %8 +%53 = OpTypeBool +%60 = OpVariable %24 Output +%62 = OpConstant %4 0.5 +%63 = OpConstantComposite %6 %27 %62 %27 %62 +%25 = OpFunction %2 None %26 +%15 = OpLabel +%18 = OpLoad %5 %16 +%20 = OpLoad %5 %19 +OpBranch %29 +%29 = OpLabel +OpLine %3 14 37 +%30 = OpVectorTimesScalar %5 %18 %10 +OpLine %3 14 10 +%31 = OpCompositeConstruct %6 %30 %27 %28 +%32 = OpCompositeConstruct %7 %20 %31 +%33 = OpCompositeExtract %5 %32 0 +OpStore %21 %33 +%34 = OpCompositeExtract %6 %32 1 +OpStore %23 %34 +%38 = OpAccessChain %35 %23 %36 +%39 = OpLoad %4 %38 +%40 = OpFNegate %4 %39 +OpStore %38 %40 OpReturn OpFunctionEnd -%44 = OpFunction %2 None %25 -%40 = OpLabel -%42 = OpLoad %4 %41 -%45 = OpLoad %7 %10 -%46 = OpLoad %8 %12 -OpBranch %47 -%47 = OpLabel -%49 = OpSampledImage %48 %45 %46 -%50 = OpImageSampleImplicitLod %5 %49 %42 -%51 = OpCompositeExtract %3 %50 3 -%53 = OpFOrdEqual %52 %51 %26 -OpSelectionMerge %54 None -OpBranchConditional %53 %55 %54 -%55 = OpLabel +%45 = OpFunction %2 None %26 +%41 = OpLabel +%43 = OpLoad %5 %42 +%46 = OpLoad %8 %11 +%47 = OpLoad %9 %13 +OpBranch %48 +%48 = OpLabel +OpLine %3 23 15 +%50 = OpSampledImage %49 %46 %47 +%51 = OpImageSampleImplicitLod %6 %50 %43 +OpLine %3 24 6 +%52 = OpCompositeExtract %4 %51 3 +OpLine %3 24 6 +%54 = OpFOrdEqual %53 %52 %27 +OpLine %3 24 3 +OpSelectionMerge %55 None +OpBranchConditional %54 %56 %55 +%56 = OpLabel OpKill -%54 = OpLabel -%56 = OpCompositeExtract %3 %50 3 -%57 = OpVectorTimesScalar %5 %50 %56 -OpStore %43 %57 +%55 = OpLabel +OpLine %3 29 23 +%57 = OpCompositeExtract %4 %51 3 +%58 = OpVectorTimesScalar %6 %51 %57 +OpStore %44 %58 OpReturn OpFunctionEnd -%60 = OpFunction %2 None %25 -%58 = OpLabel -OpBranch %63 -%63 = OpLabel -OpStore %59 %62 +%61 = OpFunction %2 None %26 +%59 = OpLabel +OpBranch %64 +%64 = OpLabel +OpLine %3 37 12 +OpStore %60 %63 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/shadow.spvasm b/naga/tests/out/spv/shadow.spvasm index d64bb2336b..8a115d36f7 100644 --- a/naga/tests/out/spv/shadow.spvasm +++ b/naga/tests/out/spv/shadow.spvasm @@ -1,420 +1,597 @@ ; SPIR-V ; Version: 1.2 ; Generator: rspirv -; Bound: 265 +; Bound: 266 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Vertex %84 "vs_main" %74 %77 %79 %81 %83 -OpEntryPoint Fragment %142 "fs_main" %133 %136 %139 %141 -OpEntryPoint Fragment %210 "fs_main_without_storage" %203 %205 %207 %209 -OpExecutionMode %142 OriginUpperLeft -OpExecutionMode %210 OriginUpperLeft -OpMemberName %8 0 "view_proj" -OpMemberName %8 1 "num_lights" -OpName %8 "Globals" -OpMemberName %9 0 "world" -OpMemberName %9 1 "color" -OpName %9 "Entity" -OpMemberName %11 0 "proj_position" -OpMemberName %11 1 "world_normal" -OpMemberName %11 2 "world_position" -OpName %11 "VertexOutput" -OpMemberName %15 0 "proj" -OpMemberName %15 1 "pos" -OpMemberName %15 2 "color" -OpName %15 "Light" -OpName %23 "c_ambient" -OpName %18 "c_max_lights" -OpName %24 "u_globals" -OpName %27 "u_entity" -OpName %30 "s_lights" -OpName %33 "u_lights" -OpName %36 "t_shadow" -OpName %38 "sampler_shadow" -OpName %41 "light_id" -OpName %42 "homogeneous_coords" -OpName %43 "fetch_shadow" -OpName %74 "position" -OpName %77 "normal" -OpName %79 "proj_position" -OpName %81 "world_normal" -OpName %83 "world_position" -OpName %84 "vs_main" -OpName %91 "out" -OpName %133 "proj_position" -OpName %136 "world_normal" -OpName %139 "world_position" -OpName %142 "fs_main" -OpName %149 "color" -OpName %150 "i" -OpName %203 "proj_position" -OpName %205 "world_normal" -OpName %207 "world_position" -OpName %210 "fs_main_without_storage" -OpName %217 "color" -OpName %218 "i" -OpMemberDecorate %8 0 Offset 0 -OpMemberDecorate %8 0 ColMajor -OpMemberDecorate %8 0 MatrixStride 16 -OpMemberDecorate %8 1 Offset 64 +OpEntryPoint Vertex %85 "vs_main" %75 %78 %80 %82 %84 +OpEntryPoint Fragment %143 "fs_main" %134 %137 %140 %142 +OpEntryPoint Fragment %211 "fs_main_without_storage" %204 %206 %208 %210 +OpExecutionMode %143 OriginUpperLeft +OpExecutionMode %211 OriginUpperLeft +%3 = OpString "shadow.wgsl" +OpSource Unknown 0 %3 "struct Globals { + view_proj: mat4x4, + num_lights: vec4, +} + +@group(0) +@binding(0) +var u_globals: Globals; + +struct Entity { + world: mat4x4, + color: vec4, +} + +@group(1) +@binding(0) +var u_entity: Entity; + +/* Not useful for testing +@vertex +fn vs_bake(@location(0) position: vec4) -> @builtin(position) vec4 { + return u_globals.view_proj * u_entity.world * vec4(position); +} +*/ + +struct VertexOutput { + @builtin(position) proj_position: vec4, + @location(0) world_normal: vec3, + @location(1) world_position: vec4, +} + +@vertex +fn vs_main( + @location(0) position: vec4, + @location(1) normal: vec4, +) -> VertexOutput { + let w = u_entity.world; + let world_pos = u_entity.world * vec4(position); + var out: VertexOutput; + out.world_normal = mat3x3(w[0].xyz, w[1].xyz, w[2].xyz) * vec3(normal.xyz); + out.world_position = world_pos; + out.proj_position = u_globals.view_proj * world_pos; + return out; +} + +// fragment shader + +struct Light { + proj: mat4x4, + pos: vec4, + color: vec4, +} + +@group(0) +@binding(1) +var s_lights: array; +@group(0) +@binding(1) +var u_lights: array; // Used when storage types are not supported +@group(0) +@binding(2) +var t_shadow: texture_depth_2d_array; +@group(0) +@binding(3) +var sampler_shadow: sampler_comparison; + +fn fetch_shadow(light_id: u32, homogeneous_coords: vec4) -> f32 { + if (homogeneous_coords.w <= 0.0) { + return 1.0; + } + // compensate for the Y-flip difference between the NDC and texture coordinates + let flip_correction = vec2(0.5, -0.5); + // compute texture coordinates for shadow lookup + let proj_correction = 1.0 / homogeneous_coords.w; + let light_local = homogeneous_coords.xy * flip_correction * proj_correction + vec2(0.5, 0.5); + // do the lookup, using HW PCF and comparison + return textureSampleCompareLevel(t_shadow, sampler_shadow, light_local, i32(light_id), homogeneous_coords.z * proj_correction); +} + +const c_ambient: vec3 = vec3(0.05, 0.05, 0.05); +const c_max_lights: u32 = 10u; + +@fragment +fn fs_main(in: VertexOutput) -> @location(0) vec4 { + let normal = normalize(in.world_normal); + // accumulate color + var color: vec3 = c_ambient; + for(var i = 0u; i < min(u_globals.num_lights.x, c_max_lights); i++) { + let light = s_lights[i]; + // project into the light space + let shadow = fetch_shadow(i, light.proj * in.world_position); + // compute Lambertian diffuse term + let light_dir = normalize(light.pos.xyz - in.world_position.xyz); + let diffuse = max(0.0, dot(normal, light_dir)); + // add light contribution + color += shadow * diffuse * light.color.xyz; + } + // multiply the light by material color + return vec4(color, 1.0) * u_entity.color; +} + +// The fragment entrypoint used when storage buffers are not available for the lights +@fragment +fn fs_main_without_storage(in: VertexOutput) -> @location(0) vec4 { + let normal = normalize(in.world_normal); + var color: vec3 = c_ambient; + for(var i = 0u; i < min(u_globals.num_lights.x, c_max_lights); i++) { + // This line is the only difference from the entrypoint above. It uses the lights + // uniform instead of the lights storage buffer + let light = u_lights[i]; + let shadow = fetch_shadow(i, light.proj * in.world_position); + let light_dir = normalize(light.pos.xyz - in.world_position.xyz); + let diffuse = max(0.0, dot(normal, light_dir)); + color += shadow * diffuse * light.color.xyz; + } + return vec4(color, 1.0) * u_entity.color; +} +" +OpMemberName %9 0 "view_proj" +OpMemberName %9 1 "num_lights" +OpName %9 "Globals" +OpMemberName %10 0 "world" +OpMemberName %10 1 "color" +OpName %10 "Entity" +OpMemberName %12 0 "proj_position" +OpMemberName %12 1 "world_normal" +OpMemberName %12 2 "world_position" +OpName %12 "VertexOutput" +OpMemberName %16 0 "proj" +OpMemberName %16 1 "pos" +OpMemberName %16 2 "color" +OpName %16 "Light" +OpName %24 "c_ambient" +OpName %19 "c_max_lights" +OpName %25 "u_globals" +OpName %28 "u_entity" +OpName %31 "s_lights" +OpName %34 "u_lights" +OpName %37 "t_shadow" +OpName %39 "sampler_shadow" +OpName %42 "light_id" +OpName %43 "homogeneous_coords" +OpName %44 "fetch_shadow" +OpName %75 "position" +OpName %78 "normal" +OpName %80 "proj_position" +OpName %82 "world_normal" +OpName %84 "world_position" +OpName %85 "vs_main" +OpName %92 "out" +OpName %134 "proj_position" +OpName %137 "world_normal" +OpName %140 "world_position" +OpName %143 "fs_main" +OpName %150 "color" +OpName %151 "i" +OpName %204 "proj_position" +OpName %206 "world_normal" +OpName %208 "world_position" +OpName %211 "fs_main_without_storage" +OpName %218 "color" +OpName %219 "i" OpMemberDecorate %9 0 Offset 0 OpMemberDecorate %9 0 ColMajor OpMemberDecorate %9 0 MatrixStride 16 OpMemberDecorate %9 1 Offset 64 -OpMemberDecorate %11 0 Offset 0 -OpMemberDecorate %11 1 Offset 16 -OpMemberDecorate %11 2 Offset 32 -OpMemberDecorate %15 0 Offset 0 -OpMemberDecorate %15 0 ColMajor -OpMemberDecorate %15 0 MatrixStride 16 -OpMemberDecorate %15 1 Offset 64 -OpMemberDecorate %15 2 Offset 80 -OpDecorate %16 ArrayStride 96 +OpMemberDecorate %10 0 Offset 0 +OpMemberDecorate %10 0 ColMajor +OpMemberDecorate %10 0 MatrixStride 16 +OpMemberDecorate %10 1 Offset 64 +OpMemberDecorate %12 0 Offset 0 +OpMemberDecorate %12 1 Offset 16 +OpMemberDecorate %12 2 Offset 32 +OpMemberDecorate %16 0 Offset 0 +OpMemberDecorate %16 0 ColMajor +OpMemberDecorate %16 0 MatrixStride 16 +OpMemberDecorate %16 1 Offset 64 +OpMemberDecorate %16 2 Offset 80 OpDecorate %17 ArrayStride 96 -OpDecorate %24 DescriptorSet 0 -OpDecorate %24 Binding 0 -OpDecorate %25 Block -OpMemberDecorate %25 0 Offset 0 -OpDecorate %27 DescriptorSet 1 -OpDecorate %27 Binding 0 -OpDecorate %28 Block -OpMemberDecorate %28 0 Offset 0 -OpDecorate %30 NonWritable -OpDecorate %30 DescriptorSet 0 -OpDecorate %30 Binding 1 -OpDecorate %31 Block -OpMemberDecorate %31 0 Offset 0 -OpDecorate %33 DescriptorSet 0 -OpDecorate %33 Binding 1 -OpDecorate %34 Block -OpMemberDecorate %34 0 Offset 0 -OpDecorate %36 DescriptorSet 0 -OpDecorate %36 Binding 2 -OpDecorate %38 DescriptorSet 0 -OpDecorate %38 Binding 3 -OpDecorate %74 Location 0 -OpDecorate %77 Location 1 -OpDecorate %79 BuiltIn Position -OpDecorate %81 Location 0 -OpDecorate %83 Location 1 -OpDecorate %133 BuiltIn FragCoord -OpDecorate %136 Location 0 -OpDecorate %139 Location 1 -OpDecorate %141 Location 0 -OpDecorate %203 BuiltIn FragCoord -OpDecorate %205 Location 0 -OpDecorate %207 Location 1 -OpDecorate %209 Location 0 +OpDecorate %18 ArrayStride 96 +OpDecorate %25 DescriptorSet 0 +OpDecorate %25 Binding 0 +OpDecorate %26 Block +OpMemberDecorate %26 0 Offset 0 +OpDecorate %28 DescriptorSet 1 +OpDecorate %28 Binding 0 +OpDecorate %29 Block +OpMemberDecorate %29 0 Offset 0 +OpDecorate %31 NonWritable +OpDecorate %31 DescriptorSet 0 +OpDecorate %31 Binding 1 +OpDecorate %32 Block +OpMemberDecorate %32 0 Offset 0 +OpDecorate %34 DescriptorSet 0 +OpDecorate %34 Binding 1 +OpDecorate %35 Block +OpMemberDecorate %35 0 Offset 0 +OpDecorate %37 DescriptorSet 0 +OpDecorate %37 Binding 2 +OpDecorate %39 DescriptorSet 0 +OpDecorate %39 Binding 3 +OpDecorate %75 Location 0 +OpDecorate %78 Location 1 +OpDecorate %80 BuiltIn Position +OpDecorate %82 Location 0 +OpDecorate %84 Location 1 +OpDecorate %134 BuiltIn FragCoord +OpDecorate %137 Location 0 +OpDecorate %140 Location 1 +OpDecorate %142 Location 0 +OpDecorate %204 BuiltIn FragCoord +OpDecorate %206 Location 0 +OpDecorate %208 Location 1 +OpDecorate %210 Location 0 %2 = OpTypeVoid -%3 = OpTypeFloat 32 -%5 = OpTypeVector %3 4 -%4 = OpTypeMatrix %5 4 -%6 = OpTypeInt 32 0 -%7 = OpTypeVector %6 4 -%8 = OpTypeStruct %4 %7 -%9 = OpTypeStruct %4 %5 -%10 = OpTypeVector %3 3 -%11 = OpTypeStruct %5 %10 %5 -%13 = OpTypeInt 32 1 -%12 = OpTypeVector %13 4 -%14 = OpTypeMatrix %10 3 -%15 = OpTypeStruct %4 %5 %5 -%16 = OpTypeRuntimeArray %15 -%18 = OpConstant %6 10 -%17 = OpTypeArray %15 %18 -%19 = OpTypeImage %3 2D 1 1 0 1 Unknown -%20 = OpTypeSampler -%21 = OpTypeVector %3 2 -%22 = OpConstant %3 0.05 -%23 = OpConstantComposite %10 %22 %22 %22 -%25 = OpTypeStruct %8 -%26 = OpTypePointer Uniform %25 -%24 = OpVariable %26 Uniform -%28 = OpTypeStruct %9 -%29 = OpTypePointer Uniform %28 -%27 = OpVariable %29 Uniform -%31 = OpTypeStruct %16 -%32 = OpTypePointer StorageBuffer %31 -%30 = OpVariable %32 StorageBuffer -%34 = OpTypeStruct %17 -%35 = OpTypePointer Uniform %34 -%33 = OpVariable %35 Uniform -%37 = OpTypePointer UniformConstant %19 -%36 = OpVariable %37 UniformConstant -%39 = OpTypePointer UniformConstant %20 -%38 = OpVariable %39 UniformConstant -%44 = OpTypeFunction %3 %6 %5 -%47 = OpConstant %3 0.0 -%48 = OpConstant %3 1.0 -%49 = OpConstant %3 0.5 -%50 = OpConstant %3 -0.5 -%51 = OpConstantComposite %21 %49 %50 -%52 = OpConstantComposite %21 %49 %49 -%55 = OpTypeBool -%68 = OpTypeSampledImage %19 -%75 = OpTypePointer Input %12 -%74 = OpVariable %75 Input -%77 = OpVariable %75 Input -%80 = OpTypePointer Output %5 -%79 = OpVariable %80 Output -%82 = OpTypePointer Output %10 -%81 = OpVariable %82 Output -%83 = OpVariable %80 Output -%85 = OpTypeFunction %2 -%86 = OpTypePointer Uniform %8 -%87 = OpConstant %6 0 -%89 = OpTypePointer Uniform %9 -%92 = OpTypePointer Function %11 -%93 = OpConstantNull %11 -%95 = OpTypePointer Uniform %4 -%102 = OpTypePointer Function %10 -%110 = OpTypeVector %13 3 -%114 = OpConstant %6 1 -%116 = OpTypePointer Function %5 -%117 = OpConstant %6 2 -%125 = OpTypePointer Output %3 -%134 = OpTypePointer Input %5 -%133 = OpVariable %134 Input -%137 = OpTypePointer Input %10 -%136 = OpVariable %137 Input -%139 = OpVariable %134 Input -%141 = OpVariable %80 Output -%145 = OpTypePointer StorageBuffer %16 -%151 = OpTypePointer Function %6 -%160 = OpTypePointer Uniform %7 -%161 = OpTypePointer Uniform %6 -%171 = OpTypePointer StorageBuffer %15 -%197 = OpTypePointer Uniform %5 -%203 = OpVariable %134 Input -%205 = OpVariable %137 Input -%207 = OpVariable %134 Input -%209 = OpVariable %80 Output -%213 = OpTypePointer Uniform %17 -%236 = OpTypePointer Uniform %15 -%43 = OpFunction %3 None %44 -%41 = OpFunctionParameter %6 -%42 = OpFunctionParameter %5 -%40 = OpLabel -%45 = OpLoad %19 %36 -%46 = OpLoad %20 %38 -OpBranch %53 -%53 = OpLabel -%54 = OpCompositeExtract %3 %42 3 -%56 = OpFOrdLessThanEqual %55 %54 %47 -OpSelectionMerge %57 None -OpBranchConditional %56 %58 %57 +%4 = OpTypeFloat 32 +%6 = OpTypeVector %4 4 +%5 = OpTypeMatrix %6 4 +%7 = OpTypeInt 32 0 +%8 = OpTypeVector %7 4 +%9 = OpTypeStruct %5 %8 +%10 = OpTypeStruct %5 %6 +%11 = OpTypeVector %4 3 +%12 = OpTypeStruct %6 %11 %6 +%14 = OpTypeInt 32 1 +%13 = OpTypeVector %14 4 +%15 = OpTypeMatrix %11 3 +%16 = OpTypeStruct %5 %6 %6 +%17 = OpTypeRuntimeArray %16 +%19 = OpConstant %7 10 +%18 = OpTypeArray %16 %19 +%20 = OpTypeImage %4 2D 1 1 0 1 Unknown +%21 = OpTypeSampler +%22 = OpTypeVector %4 2 +%23 = OpConstant %4 0.05 +%24 = OpConstantComposite %11 %23 %23 %23 +%26 = OpTypeStruct %9 +%27 = OpTypePointer Uniform %26 +%25 = OpVariable %27 Uniform +%29 = OpTypeStruct %10 +%30 = OpTypePointer Uniform %29 +%28 = OpVariable %30 Uniform +%32 = OpTypeStruct %17 +%33 = OpTypePointer StorageBuffer %32 +%31 = OpVariable %33 StorageBuffer +%35 = OpTypeStruct %18 +%36 = OpTypePointer Uniform %35 +%34 = OpVariable %36 Uniform +%38 = OpTypePointer UniformConstant %20 +%37 = OpVariable %38 UniformConstant +%40 = OpTypePointer UniformConstant %21 +%39 = OpVariable %40 UniformConstant +%45 = OpTypeFunction %4 %7 %6 +%48 = OpConstant %4 0.0 +%49 = OpConstant %4 1.0 +%50 = OpConstant %4 0.5 +%51 = OpConstant %4 -0.5 +%52 = OpConstantComposite %22 %50 %51 +%53 = OpConstantComposite %22 %50 %50 +%56 = OpTypeBool +%69 = OpTypeSampledImage %20 +%76 = OpTypePointer Input %13 +%75 = OpVariable %76 Input +%78 = OpVariable %76 Input +%81 = OpTypePointer Output %6 +%80 = OpVariable %81 Output +%83 = OpTypePointer Output %11 +%82 = OpVariable %83 Output +%84 = OpVariable %81 Output +%86 = OpTypeFunction %2 +%87 = OpTypePointer Uniform %9 +%88 = OpConstant %7 0 +%90 = OpTypePointer Uniform %10 +%93 = OpTypePointer Function %12 +%94 = OpConstantNull %12 +%96 = OpTypePointer Uniform %5 +%103 = OpTypePointer Function %11 +%111 = OpTypeVector %14 3 +%115 = OpConstant %7 1 +%117 = OpTypePointer Function %6 +%118 = OpConstant %7 2 +%126 = OpTypePointer Output %4 +%135 = OpTypePointer Input %6 +%134 = OpVariable %135 Input +%138 = OpTypePointer Input %11 +%137 = OpVariable %138 Input +%140 = OpVariable %135 Input +%142 = OpVariable %81 Output +%146 = OpTypePointer StorageBuffer %17 +%152 = OpTypePointer Function %7 +%161 = OpTypePointer Uniform %8 +%162 = OpTypePointer Uniform %7 +%172 = OpTypePointer StorageBuffer %16 +%198 = OpTypePointer Uniform %6 +%204 = OpVariable %135 Input +%206 = OpVariable %138 Input +%208 = OpVariable %135 Input +%210 = OpVariable %81 Output +%214 = OpTypePointer Uniform %18 +%237 = OpTypePointer Uniform %16 +%44 = OpFunction %4 None %45 +%42 = OpFunctionParameter %7 +%43 = OpFunctionParameter %6 +%41 = OpLabel +%46 = OpLoad %20 %37 +%47 = OpLoad %21 %39 +OpBranch %54 +%54 = OpLabel +OpLine %3 68 9 +%55 = OpCompositeExtract %4 %43 3 +OpLine %3 68 9 +%57 = OpFOrdLessThanEqual %56 %55 %48 +OpLine %3 68 5 +OpSelectionMerge %58 None +OpBranchConditional %57 %59 %58 +%59 = OpLabel +OpReturnValue %49 %58 = OpLabel -OpReturnValue %48 -%57 = OpLabel -%59 = OpCompositeExtract %3 %42 3 -%60 = OpFDiv %3 %48 %59 -%61 = OpVectorShuffle %21 %42 %42 0 1 -%62 = OpFMul %21 %61 %51 -%63 = OpVectorTimesScalar %21 %62 %60 -%64 = OpFAdd %21 %63 %52 -%65 = OpBitcast %13 %41 -%66 = OpCompositeExtract %3 %42 2 -%67 = OpFMul %3 %66 %60 -%69 = OpConvertSToF %3 %65 -%70 = OpCompositeConstruct %10 %64 %69 -%71 = OpSampledImage %68 %45 %46 -%72 = OpImageSampleDrefExplicitLod %3 %71 %70 %67 Lod %47 -OpReturnValue %72 +OpLine %3 72 27 +OpLine %3 74 33 +%60 = OpCompositeExtract %4 %43 3 +OpLine %3 74 27 +%61 = OpFDiv %4 %49 %60 +OpLine %3 75 23 +%62 = OpVectorShuffle %22 %43 %43 0 1 +%63 = OpFMul %22 %62 %52 +%64 = OpVectorTimesScalar %22 %63 %61 +OpLine %3 75 23 +%65 = OpFAdd %22 %64 %53 +OpLine %3 77 12 +%66 = OpBitcast %14 %42 +%67 = OpCompositeExtract %4 %43 2 +%68 = OpFMul %4 %67 %61 +%70 = OpConvertSToF %4 %66 +%71 = OpCompositeConstruct %11 %65 %70 +%72 = OpSampledImage %69 %46 %47 +%73 = OpImageSampleDrefExplicitLod %4 %72 %71 %68 Lod %48 +OpReturnValue %73 OpFunctionEnd -%84 = OpFunction %2 None %85 -%73 = OpLabel -%91 = OpVariable %92 Function %93 -%76 = OpLoad %12 %74 -%78 = OpLoad %12 %77 -%88 = OpAccessChain %86 %24 %87 -%90 = OpAccessChain %89 %27 %87 -OpBranch %94 -%94 = OpLabel -%96 = OpAccessChain %95 %90 %87 -%97 = OpLoad %4 %96 -%98 = OpAccessChain %95 %90 %87 -%99 = OpLoad %4 %98 -%100 = OpConvertSToF %5 %76 -%101 = OpMatrixTimesVector %5 %99 %100 -%103 = OpCompositeExtract %5 %97 0 -%104 = OpVectorShuffle %10 %103 %103 0 1 2 -%105 = OpCompositeExtract %5 %97 1 -%106 = OpVectorShuffle %10 %105 %105 0 1 2 -%107 = OpCompositeExtract %5 %97 2 -%108 = OpVectorShuffle %10 %107 %107 0 1 2 -%109 = OpCompositeConstruct %14 %104 %106 %108 -%111 = OpVectorShuffle %110 %78 %78 0 1 2 -%112 = OpConvertSToF %10 %111 -%113 = OpMatrixTimesVector %10 %109 %112 -%115 = OpAccessChain %102 %91 %114 -OpStore %115 %113 -%118 = OpAccessChain %116 %91 %117 -OpStore %118 %101 -%119 = OpAccessChain %95 %88 %87 -%120 = OpLoad %4 %119 -%121 = OpMatrixTimesVector %5 %120 %101 -%122 = OpAccessChain %116 %91 %87 -OpStore %122 %121 -%123 = OpLoad %11 %91 -%124 = OpCompositeExtract %5 %123 0 -OpStore %79 %124 -%126 = OpAccessChain %125 %79 %114 -%127 = OpLoad %3 %126 -%128 = OpFNegate %3 %127 -OpStore %126 %128 -%129 = OpCompositeExtract %10 %123 1 -OpStore %81 %129 -%130 = OpCompositeExtract %5 %123 2 -OpStore %83 %130 +%85 = OpFunction %2 None %86 +%74 = OpLabel +%92 = OpVariable %93 Function %94 +%77 = OpLoad %13 %75 +%79 = OpLoad %13 %78 +%89 = OpAccessChain %87 %25 %88 +%91 = OpAccessChain %90 %28 %88 +OpBranch %95 +%95 = OpLabel +OpLine %3 37 13 +%97 = OpAccessChain %96 %91 %88 +%98 = OpLoad %5 %97 +OpLine %3 38 21 +%99 = OpAccessChain %96 %91 %88 +%100 = OpLoad %5 %99 +%101 = OpConvertSToF %6 %77 +%102 = OpMatrixTimesVector %6 %100 %101 +OpLine %3 40 5 +OpLine %3 40 36 +%104 = OpCompositeExtract %6 %98 0 +%105 = OpVectorShuffle %11 %104 %104 0 1 2 +OpLine %3 40 46 +%106 = OpCompositeExtract %6 %98 1 +%107 = OpVectorShuffle %11 %106 %106 0 1 2 +OpLine %3 40 24 +%108 = OpCompositeExtract %6 %98 2 +%109 = OpVectorShuffle %11 %108 %108 0 1 2 +%110 = OpCompositeConstruct %15 %105 %107 %109 +%112 = OpVectorShuffle %111 %79 %79 0 1 2 +%113 = OpConvertSToF %11 %112 +%114 = OpMatrixTimesVector %11 %110 %113 +OpLine %3 40 5 +%116 = OpAccessChain %103 %92 %115 +OpStore %116 %114 +OpLine %3 41 5 +OpLine %3 41 5 +%119 = OpAccessChain %117 %92 %118 +OpStore %119 %102 +OpLine %3 42 5 +OpLine %3 42 25 +%120 = OpAccessChain %96 %89 %88 +%121 = OpLoad %5 %120 +%122 = OpMatrixTimesVector %6 %121 %102 +OpLine %3 42 5 +%123 = OpAccessChain %117 %92 %88 +OpStore %123 %122 +OpLine %3 1 1 +%124 = OpLoad %12 %92 +%125 = OpCompositeExtract %6 %124 0 +OpStore %80 %125 +%127 = OpAccessChain %126 %80 %115 +%128 = OpLoad %4 %127 +%129 = OpFNegate %4 %128 +OpStore %127 %129 +%130 = OpCompositeExtract %11 %124 1 +OpStore %82 %130 +%131 = OpCompositeExtract %6 %124 2 +OpStore %84 %131 OpReturn OpFunctionEnd -%142 = OpFunction %2 None %85 -%131 = OpLabel -%149 = OpVariable %102 Function %23 -%150 = OpVariable %151 Function %87 -%135 = OpLoad %5 %133 -%138 = OpLoad %10 %136 -%140 = OpLoad %5 %139 -%132 = OpCompositeConstruct %11 %135 %138 %140 -%143 = OpAccessChain %86 %24 %87 -%144 = OpAccessChain %89 %27 %87 -%146 = OpAccessChain %145 %30 %87 -%147 = OpLoad %19 %36 -%148 = OpLoad %20 %38 -OpBranch %152 -%152 = OpLabel -%153 = OpCompositeExtract %10 %132 1 -%154 = OpExtInst %10 %1 Normalize %153 -OpBranch %155 -%155 = OpLabel -OpLoopMerge %156 %158 None -OpBranch %157 -%157 = OpLabel -%159 = OpLoad %6 %150 -%162 = OpAccessChain %161 %143 %114 %87 -%163 = OpLoad %6 %162 -%164 = OpExtInst %6 %1 UMin %163 %18 -%165 = OpULessThan %55 %159 %164 -OpSelectionMerge %166 None -OpBranchConditional %165 %166 %167 -%167 = OpLabel +%143 = OpFunction %2 None %86 +%132 = OpLabel +%150 = OpVariable %103 Function %24 +%151 = OpVariable %152 Function %88 +%136 = OpLoad %6 %134 +%139 = OpLoad %11 %137 +%141 = OpLoad %6 %140 +%133 = OpCompositeConstruct %12 %136 %139 %141 +%144 = OpAccessChain %87 %25 %88 +%145 = OpAccessChain %90 %28 %88 +%147 = OpAccessChain %146 %31 %88 +%148 = OpLoad %20 %37 +%149 = OpLoad %21 %39 +OpBranch %153 +%153 = OpLabel +OpLine %3 85 18 +%154 = OpCompositeExtract %11 %133 1 +%155 = OpExtInst %11 %1 Normalize %154 OpBranch %156 -%166 = OpLabel -OpBranch %168 -%168 = OpLabel -%170 = OpLoad %6 %150 -%172 = OpAccessChain %171 %146 %170 -%173 = OpLoad %15 %172 -%174 = OpLoad %6 %150 -%175 = OpCompositeExtract %4 %173 0 -%176 = OpCompositeExtract %5 %132 2 -%177 = OpMatrixTimesVector %5 %175 %176 -%178 = OpFunctionCall %3 %43 %174 %177 -%179 = OpCompositeExtract %5 %173 1 -%180 = OpVectorShuffle %10 %179 %179 0 1 2 -%181 = OpCompositeExtract %5 %132 2 -%182 = OpVectorShuffle %10 %181 %181 0 1 2 -%183 = OpFSub %10 %180 %182 -%184 = OpExtInst %10 %1 Normalize %183 -%185 = OpDot %3 %154 %184 -%186 = OpExtInst %3 %1 FMax %47 %185 -%187 = OpFMul %3 %178 %186 -%188 = OpCompositeExtract %5 %173 2 -%189 = OpVectorShuffle %10 %188 %188 0 1 2 -%190 = OpVectorTimesScalar %10 %189 %187 -%191 = OpLoad %10 %149 -%192 = OpFAdd %10 %191 %190 -OpStore %149 %192 -OpBranch %169 -%169 = OpLabel +%156 = OpLabel +OpLine %3 88 5 +OpLoopMerge %157 %159 None OpBranch %158 %158 = OpLabel -%193 = OpLoad %6 %150 -%194 = OpIAdd %6 %193 %114 -OpStore %150 %194 -OpBranch %155 -%156 = OpLabel -%195 = OpLoad %10 %149 -%196 = OpCompositeConstruct %5 %195 %48 -%198 = OpAccessChain %197 %144 %114 -%199 = OpLoad %5 %198 -%200 = OpFMul %5 %196 %199 -OpStore %141 %200 +OpLine %3 1 1 +%160 = OpLoad %7 %151 +OpLine %3 88 29 +%163 = OpAccessChain %162 %144 %115 %88 +%164 = OpLoad %7 %163 +OpLine %3 88 21 +%165 = OpExtInst %7 %1 UMin %164 %19 +%166 = OpULessThan %56 %160 %165 +OpLine %3 88 20 +OpSelectionMerge %167 None +OpBranchConditional %166 %167 %168 +%168 = OpLabel +OpBranch %157 +%167 = OpLabel +OpBranch %169 +%169 = OpLabel +OpLine %3 89 21 +%171 = OpLoad %7 %151 +%173 = OpAccessChain %172 %147 %171 +%174 = OpLoad %16 %173 +OpLine %3 91 38 +%175 = OpLoad %7 %151 +%176 = OpCompositeExtract %5 %174 0 +%177 = OpCompositeExtract %6 %133 2 +%178 = OpMatrixTimesVector %6 %176 %177 +OpLine %3 91 22 +%179 = OpFunctionCall %4 %44 %175 %178 +OpLine %3 93 25 +%180 = OpCompositeExtract %6 %174 1 +%181 = OpVectorShuffle %11 %180 %180 0 1 2 +%182 = OpCompositeExtract %6 %133 2 +%183 = OpVectorShuffle %11 %182 %182 0 1 2 +%184 = OpFSub %11 %181 %183 +%185 = OpExtInst %11 %1 Normalize %184 +OpLine %3 94 23 +%186 = OpDot %4 %155 %185 +%187 = OpExtInst %4 %1 FMax %48 %186 +OpLine %3 96 9 +%188 = OpFMul %4 %179 %187 +%189 = OpCompositeExtract %6 %174 2 +%190 = OpVectorShuffle %11 %189 %189 0 1 2 +%191 = OpVectorTimesScalar %11 %190 %188 +%192 = OpLoad %11 %150 +%193 = OpFAdd %11 %192 %191 +OpLine %3 96 9 +OpStore %150 %193 +OpBranch %170 +%170 = OpLabel +OpBranch %159 +%159 = OpLabel +OpLine %3 88 68 +%194 = OpLoad %7 %151 +%195 = OpIAdd %7 %194 %115 +OpLine %3 88 68 +OpStore %151 %195 +OpBranch %156 +%157 = OpLabel +OpLine %3 1 1 +%196 = OpLoad %11 %150 +OpLine %3 99 12 +%197 = OpCompositeConstruct %6 %196 %49 +OpLine %3 99 12 +%199 = OpAccessChain %198 %145 %115 +%200 = OpLoad %6 %199 +%201 = OpFMul %6 %197 %200 +OpStore %142 %201 OpReturn OpFunctionEnd -%210 = OpFunction %2 None %85 -%201 = OpLabel -%217 = OpVariable %102 Function %23 -%218 = OpVariable %151 Function %87 -%204 = OpLoad %5 %203 -%206 = OpLoad %10 %205 -%208 = OpLoad %5 %207 -%202 = OpCompositeConstruct %11 %204 %206 %208 -%211 = OpAccessChain %86 %24 %87 -%212 = OpAccessChain %89 %27 %87 -%214 = OpAccessChain %213 %33 %87 -%215 = OpLoad %19 %36 -%216 = OpLoad %20 %38 -OpBranch %219 -%219 = OpLabel -%220 = OpCompositeExtract %10 %202 1 -%221 = OpExtInst %10 %1 Normalize %220 -OpBranch %222 -%222 = OpLabel -OpLoopMerge %223 %225 None -OpBranch %224 -%224 = OpLabel -%226 = OpLoad %6 %218 -%227 = OpAccessChain %161 %211 %114 %87 -%228 = OpLoad %6 %227 -%229 = OpExtInst %6 %1 UMin %228 %18 -%230 = OpULessThan %55 %226 %229 -OpSelectionMerge %231 None -OpBranchConditional %230 %231 %232 -%232 = OpLabel +%211 = OpFunction %2 None %86 +%202 = OpLabel +%218 = OpVariable %103 Function %24 +%219 = OpVariable %152 Function %88 +%205 = OpLoad %6 %204 +%207 = OpLoad %11 %206 +%209 = OpLoad %6 %208 +%203 = OpCompositeConstruct %12 %205 %207 %209 +%212 = OpAccessChain %87 %25 %88 +%213 = OpAccessChain %90 %28 %88 +%215 = OpAccessChain %214 %34 %88 +%216 = OpLoad %20 %37 +%217 = OpLoad %21 %39 +OpBranch %220 +%220 = OpLabel +OpLine %3 105 18 +%221 = OpCompositeExtract %11 %203 1 +%222 = OpExtInst %11 %1 Normalize %221 OpBranch %223 -%231 = OpLabel -OpBranch %233 -%233 = OpLabel -%235 = OpLoad %6 %218 -%237 = OpAccessChain %236 %214 %235 -%238 = OpLoad %15 %237 -%239 = OpLoad %6 %218 -%240 = OpCompositeExtract %4 %238 0 -%241 = OpCompositeExtract %5 %202 2 -%242 = OpMatrixTimesVector %5 %240 %241 -%243 = OpFunctionCall %3 %43 %239 %242 -%244 = OpCompositeExtract %5 %238 1 -%245 = OpVectorShuffle %10 %244 %244 0 1 2 -%246 = OpCompositeExtract %5 %202 2 -%247 = OpVectorShuffle %10 %246 %246 0 1 2 -%248 = OpFSub %10 %245 %247 -%249 = OpExtInst %10 %1 Normalize %248 -%250 = OpDot %3 %221 %249 -%251 = OpExtInst %3 %1 FMax %47 %250 -%252 = OpFMul %3 %243 %251 -%253 = OpCompositeExtract %5 %238 2 -%254 = OpVectorShuffle %10 %253 %253 0 1 2 -%255 = OpVectorTimesScalar %10 %254 %252 -%256 = OpLoad %10 %217 -%257 = OpFAdd %10 %256 %255 -OpStore %217 %257 -OpBranch %234 -%234 = OpLabel +%223 = OpLabel +OpLine %3 107 5 +OpLoopMerge %224 %226 None OpBranch %225 %225 = OpLabel -%258 = OpLoad %6 %218 -%259 = OpIAdd %6 %258 %114 -OpStore %218 %259 -OpBranch %222 -%223 = OpLabel -%260 = OpLoad %10 %217 -%261 = OpCompositeConstruct %5 %260 %48 -%262 = OpAccessChain %197 %212 %114 -%263 = OpLoad %5 %262 -%264 = OpFMul %5 %261 %263 -OpStore %209 %264 +OpLine %3 1 1 +%227 = OpLoad %7 %219 +OpLine %3 107 29 +%228 = OpAccessChain %162 %212 %115 %88 +%229 = OpLoad %7 %228 +OpLine %3 107 21 +%230 = OpExtInst %7 %1 UMin %229 %19 +%231 = OpULessThan %56 %227 %230 +OpLine %3 107 20 +OpSelectionMerge %232 None +OpBranchConditional %231 %232 %233 +%233 = OpLabel +OpBranch %224 +%232 = OpLabel +OpBranch %234 +%234 = OpLabel +OpLine %3 110 21 +%236 = OpLoad %7 %219 +%238 = OpAccessChain %237 %215 %236 +%239 = OpLoad %16 %238 +OpLine %3 111 38 +%240 = OpLoad %7 %219 +%241 = OpCompositeExtract %5 %239 0 +%242 = OpCompositeExtract %6 %203 2 +%243 = OpMatrixTimesVector %6 %241 %242 +OpLine %3 111 22 +%244 = OpFunctionCall %4 %44 %240 %243 +OpLine %3 112 25 +%245 = OpCompositeExtract %6 %239 1 +%246 = OpVectorShuffle %11 %245 %245 0 1 2 +%247 = OpCompositeExtract %6 %203 2 +%248 = OpVectorShuffle %11 %247 %247 0 1 2 +%249 = OpFSub %11 %246 %248 +%250 = OpExtInst %11 %1 Normalize %249 +OpLine %3 113 23 +%251 = OpDot %4 %222 %250 +%252 = OpExtInst %4 %1 FMax %48 %251 +OpLine %3 114 9 +%253 = OpFMul %4 %244 %252 +%254 = OpCompositeExtract %6 %239 2 +%255 = OpVectorShuffle %11 %254 %254 0 1 2 +%256 = OpVectorTimesScalar %11 %255 %253 +%257 = OpLoad %11 %218 +%258 = OpFAdd %11 %257 %256 +OpLine %3 114 9 +OpStore %218 %258 +OpBranch %235 +%235 = OpLabel +OpBranch %226 +%226 = OpLabel +OpLine %3 107 68 +%259 = OpLoad %7 %219 +%260 = OpIAdd %7 %259 %115 +OpLine %3 107 68 +OpStore %219 %260 +OpBranch %223 +%224 = OpLabel +OpLine %3 1 1 +%261 = OpLoad %11 %218 +OpLine %3 116 12 +%262 = OpCompositeConstruct %6 %261 %49 +OpLine %3 116 12 +%263 = OpAccessChain %198 %213 %115 +%264 = OpLoad %6 %263 +%265 = OpFMul %6 %262 %264 +OpStore %210 %265 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/texture-arg.spvasm b/naga/tests/out/spv/texture-arg.spvasm index 88832eb193..ebb110e8fd 100644 --- a/naga/tests/out/spv/texture-arg.spvasm +++ b/naga/tests/out/spv/texture-arg.spvasm @@ -1,59 +1,76 @@ ; SPIR-V ; Version: 1.0 ; Generator: rspirv -; Bound: 34 +; Bound: 35 OpCapability Shader %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint Fragment %28 "main" %26 -OpExecutionMode %28 OriginUpperLeft -OpName %8 "Texture" -OpName %10 "Sampler" -OpName %13 "Passed_Texture" -OpName %15 "Passed_Sampler" -OpName %17 "test" -OpName %28 "main" -OpDecorate %8 DescriptorSet 0 -OpDecorate %8 Binding 0 -OpDecorate %10 DescriptorSet 0 -OpDecorate %10 Binding 1 -OpDecorate %26 Location 0 +OpEntryPoint Fragment %29 "main" %27 +OpExecutionMode %29 OriginUpperLeft +%3 = OpString "texture-arg.wgsl" +OpSource Unknown 0 %3 "@group(0) @binding(0) +var Texture: texture_2d; +@group(0) @binding(1) +var Sampler: sampler; + +fn test(Passed_Texture: texture_2d, Passed_Sampler: sampler) -> vec4 { + return textureSample(Passed_Texture, Passed_Sampler, vec2(0.0, 0.0)); +} + +@fragment +fn main() -> @location(0) vec4 { + return test(Texture, Sampler); +} +" +OpName %9 "Texture" +OpName %11 "Sampler" +OpName %14 "Passed_Texture" +OpName %16 "Passed_Sampler" +OpName %18 "test" +OpName %29 "main" +OpDecorate %9 DescriptorSet 0 +OpDecorate %9 Binding 0 +OpDecorate %11 DescriptorSet 0 +OpDecorate %11 Binding 1 +OpDecorate %27 Location 0 %2 = OpTypeVoid -%4 = OpTypeFloat 32 -%3 = OpTypeImage %4 2D 0 0 0 1 Unknown -%5 = OpTypeSampler -%6 = OpTypeVector %4 4 -%7 = OpTypeVector %4 2 -%9 = OpTypePointer UniformConstant %3 -%8 = OpVariable %9 UniformConstant -%11 = OpTypePointer UniformConstant %5 -%10 = OpVariable %11 UniformConstant -%18 = OpTypeFunction %6 %9 %11 -%19 = OpConstant %4 0.0 -%20 = OpConstantComposite %7 %19 %19 -%22 = OpTypeSampledImage %3 -%27 = OpTypePointer Output %6 -%26 = OpVariable %27 Output -%29 = OpTypeFunction %2 -%17 = OpFunction %6 None %18 -%13 = OpFunctionParameter %9 -%15 = OpFunctionParameter %11 -%12 = OpLabel -%14 = OpLoad %3 %13 -%16 = OpLoad %5 %15 -OpBranch %21 -%21 = OpLabel -%23 = OpSampledImage %22 %14 %16 -%24 = OpImageSampleImplicitLod %6 %23 %20 -OpReturnValue %24 +%5 = OpTypeFloat 32 +%4 = OpTypeImage %5 2D 0 0 0 1 Unknown +%6 = OpTypeSampler +%7 = OpTypeVector %5 4 +%8 = OpTypeVector %5 2 +%10 = OpTypePointer UniformConstant %4 +%9 = OpVariable %10 UniformConstant +%12 = OpTypePointer UniformConstant %6 +%11 = OpVariable %12 UniformConstant +%19 = OpTypeFunction %7 %10 %12 +%20 = OpConstant %5 0.0 +%21 = OpConstantComposite %8 %20 %20 +%23 = OpTypeSampledImage %4 +%28 = OpTypePointer Output %7 +%27 = OpVariable %28 Output +%30 = OpTypeFunction %2 +%18 = OpFunction %7 None %19 +%14 = OpFunctionParameter %10 +%16 = OpFunctionParameter %12 +%13 = OpLabel +%15 = OpLoad %4 %14 +%17 = OpLoad %6 %16 +OpBranch %22 +%22 = OpLabel +OpLine %3 7 12 +%24 = OpSampledImage %23 %15 %17 +%25 = OpImageSampleImplicitLod %7 %24 %21 +OpReturnValue %25 OpFunctionEnd -%28 = OpFunction %2 None %29 -%25 = OpLabel -%30 = OpLoad %3 %8 -%31 = OpLoad %5 %10 -OpBranch %32 -%32 = OpLabel -%33 = OpFunctionCall %6 %17 %8 %10 -OpStore %26 %33 +%29 = OpFunction %2 None %30 +%26 = OpLabel +%31 = OpLoad %4 %9 +%32 = OpLoad %6 %11 +OpBranch %33 +%33 = OpLabel +OpLine %3 12 12 +%34 = OpFunctionCall %7 %18 %9 %11 +OpStore %27 %34 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/out/spv/workgroup-var-init.spvasm b/naga/tests/out/spv/workgroup-var-init.spvasm index 399f63855c..cb214f3e35 100644 --- a/naga/tests/out/spv/workgroup-var-init.spvasm +++ b/naga/tests/out/spv/workgroup-var-init.spvasm @@ -1,77 +1,95 @@ ; SPIR-V ; Version: 1.1 ; Generator: rspirv -; Bound: 41 +; Bound: 42 OpCapability Shader OpExtension "SPV_KHR_storage_buffer_storage_class" %1 = OpExtInstImport "GLSL.std.450" OpMemoryModel Logical GLSL450 -OpEntryPoint GLCompute %17 "main" %25 -OpExecutionMode %17 LocalSize 1 1 1 -OpMemberName %10 0 "arr" -OpMemberName %10 1 "atom" -OpMemberName %10 2 "atom_arr" -OpName %10 "WStruct" -OpName %11 "w_mem" -OpName %13 "output" -OpName %17 "main" -OpDecorate %4 ArrayStride 4 -OpDecorate %7 ArrayStride 4 -OpDecorate %9 ArrayStride 32 -OpMemberDecorate %10 0 Offset 0 -OpMemberDecorate %10 1 Offset 2048 -OpMemberDecorate %10 2 Offset 2052 -OpDecorate %13 DescriptorSet 0 -OpDecorate %13 Binding 0 -OpDecorate %14 Block -OpMemberDecorate %14 0 Offset 0 -OpDecorate %25 BuiltIn LocalInvocationId +OpEntryPoint GLCompute %18 "main" %26 +OpExecutionMode %18 LocalSize 1 1 1 +%3 = OpString "workgroup-var-init.wgsl" +OpSource Unknown 0 %3 "struct WStruct { + arr: array, + atom: atomic, + atom_arr: array, 8>, 8>, +} + +var w_mem: WStruct; + +@group(0) @binding(0) +var output: array; + +@compute @workgroup_size(1) +fn main() { + output = w_mem.arr; +}" +OpMemberName %11 0 "arr" +OpMemberName %11 1 "atom" +OpMemberName %11 2 "atom_arr" +OpName %11 "WStruct" +OpName %12 "w_mem" +OpName %14 "output" +OpName %18 "main" +OpDecorate %5 ArrayStride 4 +OpDecorate %8 ArrayStride 4 +OpDecorate %10 ArrayStride 32 +OpMemberDecorate %11 0 Offset 0 +OpMemberDecorate %11 1 Offset 2048 +OpMemberDecorate %11 2 Offset 2052 +OpDecorate %14 DescriptorSet 0 +OpDecorate %14 Binding 0 +OpDecorate %15 Block +OpMemberDecorate %15 0 Offset 0 +OpDecorate %26 BuiltIn LocalInvocationId %2 = OpTypeVoid -%3 = OpTypeInt 32 0 -%5 = OpConstant %3 512 -%4 = OpTypeArray %3 %5 -%6 = OpTypeInt 32 1 -%8 = OpConstant %3 8 -%7 = OpTypeArray %6 %8 -%9 = OpTypeArray %7 %8 -%10 = OpTypeStruct %4 %6 %9 -%12 = OpTypePointer Workgroup %10 -%11 = OpVariable %12 Workgroup -%14 = OpTypeStruct %4 -%15 = OpTypePointer StorageBuffer %14 -%13 = OpVariable %15 StorageBuffer -%18 = OpTypeFunction %2 -%19 = OpTypePointer StorageBuffer %4 -%20 = OpConstant %3 0 -%23 = OpConstantNull %10 -%24 = OpTypeVector %3 3 -%26 = OpTypePointer Input %24 -%25 = OpVariable %26 Input -%28 = OpConstantNull %24 -%30 = OpTypeBool -%29 = OpTypeVector %30 3 -%35 = OpConstant %3 2 -%36 = OpConstant %3 264 -%38 = OpTypePointer Workgroup %4 -%17 = OpFunction %2 None %18 -%16 = OpLabel -%21 = OpAccessChain %19 %13 %20 -OpBranch %22 -%22 = OpLabel -%27 = OpLoad %24 %25 -%31 = OpIEqual %29 %27 %28 -%32 = OpAll %30 %31 -OpSelectionMerge %33 None -OpBranchConditional %32 %34 %33 +%4 = OpTypeInt 32 0 +%6 = OpConstant %4 512 +%5 = OpTypeArray %4 %6 +%7 = OpTypeInt 32 1 +%9 = OpConstant %4 8 +%8 = OpTypeArray %7 %9 +%10 = OpTypeArray %8 %9 +%11 = OpTypeStruct %5 %7 %10 +%13 = OpTypePointer Workgroup %11 +%12 = OpVariable %13 Workgroup +%15 = OpTypeStruct %5 +%16 = OpTypePointer StorageBuffer %15 +%14 = OpVariable %16 StorageBuffer +%19 = OpTypeFunction %2 +%20 = OpTypePointer StorageBuffer %5 +%21 = OpConstant %4 0 +%24 = OpConstantNull %11 +%25 = OpTypeVector %4 3 +%27 = OpTypePointer Input %25 +%26 = OpVariable %27 Input +%29 = OpConstantNull %25 +%31 = OpTypeBool +%30 = OpTypeVector %31 3 +%36 = OpConstant %4 2 +%37 = OpConstant %4 264 +%39 = OpTypePointer Workgroup %5 +%18 = OpFunction %2 None %19 +%17 = OpLabel +%22 = OpAccessChain %20 %14 %21 +OpBranch %23 +%23 = OpLabel +%28 = OpLoad %25 %26 +%32 = OpIEqual %30 %28 %29 +%33 = OpAll %31 %32 +OpSelectionMerge %34 None +OpBranchConditional %33 %35 %34 +%35 = OpLabel +OpStore %12 %24 +OpBranch %34 %34 = OpLabel -OpStore %11 %23 -OpBranch %33 -%33 = OpLabel -OpControlBarrier %35 %35 %36 -OpBranch %37 -%37 = OpLabel -%39 = OpAccessChain %38 %11 %20 -%40 = OpLoad %4 %39 -OpStore %21 %40 +OpControlBarrier %36 %36 %37 +OpBranch %38 +%38 = OpLabel +OpLine %3 14 14 +%40 = OpAccessChain %39 %12 %21 +%41 = OpLoad %5 %40 +OpLine %3 14 5 +OpStore %22 %41 OpReturn OpFunctionEnd \ No newline at end of file diff --git a/naga/tests/snapshots.rs b/naga/tests/snapshots.rs index cc56f5e053..2fea963d51 100644 --- a/naga/tests/snapshots.rs +++ b/naga/tests/snapshots.rs @@ -7,12 +7,16 @@ use std::{ path::{Path, PathBuf}, }; +use ron::de; + const CRATE_ROOT: &str = env!("CARGO_MANIFEST_DIR"); const BASE_DIR_IN: &str = "tests/in"; const BASE_DIR_OUT: &str = "tests/out"; bitflags::bitflags! { - #[derive(Clone, Copy)] + #[derive(Clone, Copy, serde::Deserialize)] + #[serde(transparent)] + #[derive(Debug, Eq, PartialEq)] struct Targets: u32 { /// A serialization of the `naga::Module`, in RON format. const IR = 1; @@ -30,6 +34,12 @@ bitflags::bitflags! { } } +impl Default for Targets { + fn default() -> Self { + Targets::WGSL + } +} + #[derive(serde::Deserialize)] struct SpvOutVersion(u8, u8); impl Default for SpvOutVersion { @@ -58,6 +68,12 @@ struct WgslOutParameters { explicit_types: bool, } +#[derive(Default, serde::Deserialize)] +struct FragmentModule { + path: String, + entry_point: String, +} + #[derive(Default, serde::Deserialize)] #[serde(default)] struct Parameters { @@ -67,6 +83,8 @@ struct Parameters { // -- SPIR-V options -- spv: SpirvOutParameters, + targets: Targets, + // -- MSL options -- #[cfg(all(feature = "deserialize", msl_out))] msl: naga::back::msl::Options, @@ -84,11 +102,17 @@ struct Parameters { // -- HLSL options -- #[cfg(all(feature = "deserialize", hlsl_out))] hlsl: naga::back::hlsl::Options, + hlsl_module_path: Option, // -- WGSL options -- wgsl: WgslOutParameters, // -- General options -- + + // Allow backends to be aware of the fragment module. + // Is the name of a WGSL file in the same directory as the test file. + fragment_module: Option, + #[cfg(feature = "deserialize")] bounds_check_policies: naga::proc::BoundsCheckPolicies, @@ -111,7 +135,7 @@ struct Input { /// True if output filenames should add the output extension on top of /// `file_name`'s existing extension, rather than replacing it. /// - /// This is used by `convert_glsl_folder`, which wants to take input files + /// This is used by `convert_snapshots_glsl`, which wants to take input files /// like `210-bevy-2d-shader.frag` and just add `.wgsl` to it, producing /// `210-bevy-2d-shader.frag.wgsl`. keep_input_extension: bool, @@ -137,32 +161,45 @@ impl Input { } /// Return an iterator that produces an `Input` for each entry in `subdirectory`. - fn files_in_dir(subdirectory: &str) -> impl Iterator + 'static { - let subdirectory = subdirectory.to_string(); + fn files_in_dir( + subdirectory: Option<&'static str>, + file_extensions: &'static [&'static str], + ) -> impl Iterator + 'static { let mut input_directory = Path::new(env!("CARGO_MANIFEST_DIR")).join(BASE_DIR_IN); - input_directory.push(&subdirectory); - match std::fs::read_dir(&input_directory) { - Ok(entries) => entries.map(move |result| { - let entry = result.expect("error reading directory"); - let file_name = PathBuf::from(entry.file_name()); - let extension = file_name - .extension() - .expect("all files in snapshot input directory should have extensions"); - let input = Input::new( - Some(&subdirectory), - file_name.file_stem().unwrap().to_str().unwrap(), - extension.to_str().unwrap(), - ); - input - }), - Err(err) => { - panic!( - "Error opening directory '{}': {}", - input_directory.display(), - err - ); - } + if let Some(ref subdirectory) = subdirectory { + input_directory.push(subdirectory); } + let entries = match std::fs::read_dir(&input_directory) { + Ok(entries) => entries, + Err(err) => panic!( + "Error opening directory '{}': {}", + input_directory.display(), + err + ), + }; + + entries.filter_map(move |result| { + let entry = result.expect("error reading directory"); + if !entry.file_type().unwrap().is_file() { + return None; + } + + let file_name = PathBuf::from(entry.file_name()); + let extension = file_name + .extension() + .expect("all files in snapshot input directory should have extensions"); + + if !file_extensions.contains(&extension.to_str().unwrap()) { + return None; + } + + let input = Input::new( + subdirectory, + file_name.file_stem().unwrap().to_str().unwrap(), + extension.to_str().unwrap(), + ); + Some(input) + }) } /// Return the path to the input directory. @@ -254,6 +291,7 @@ impl Input { /// `subdirectory`, with `extension`. fn write_output_file(&self, subdirectory: &str, extension: &str, data: impl AsRef<[u8]>) { let output_path = self.output_path(subdirectory, extension); + fs::create_dir_all(output_path.parent().unwrap()).unwrap(); if let Err(err) = fs::write(&output_path, data) { panic!("Error writing {}: {}", output_path.display(), err); } @@ -266,21 +304,12 @@ type FragmentEntryPoint<'a> = naga::back::hlsl::FragmentEntryPoint<'a>; type FragmentEntryPoint<'a> = (); #[allow(unused_variables)] -fn check_targets( - input: &Input, - module: &mut naga::Module, - targets: Targets, - source_code: Option<&str>, - // For testing hlsl generation when fragment shader doesn't consume all vertex outputs. - frag_ep: Option, -) { - if frag_ep.is_some() && !targets.contains(Targets::HLSL) { - panic!("Providing FragmentEntryPoint only makes sense when testing hlsl-out"); - } - +fn check_targets(input: &Input, module: &mut naga::Module, source_code: Option<&str>) { let params = input.read_parameters(); let name = &input.file_name; + let targets = params.targets; + let (capabilities, subgroup_stages, subgroup_operations) = if params.god_mode { ( naga::valid::Capabilities::all(), @@ -359,16 +388,19 @@ fn check_targets( #[cfg(all(feature = "deserialize", spv_out))] { - let debug_info = source_code.map(|code| naga::back::spv::DebugInfo { - source_code: code, - file_name: name.as_ref(), - // wgpu#6266: we technically know all the information here to - // produce the valid language but it's not too important for - // validation purposes - language: naga::back::spv::SourceLanguage::Unknown, - }); - if targets.contains(Targets::SPIRV) { + let mut debug_info = None; + if let Some(source_code) = source_code { + debug_info = Some(naga::back::spv::DebugInfo { + source_code, + file_name: name, + // wgpu#6266: we technically know all the information here to + // produce the valid language but it's not too important for + // validation purposes + language: naga::back::spv::SourceLanguage::Unknown, + }) + } + write_output_spv( input, module, @@ -425,6 +457,31 @@ fn check_targets( #[cfg(all(feature = "deserialize", hlsl_out))] { if targets.contains(Targets::HLSL) { + let frag_module; + let mut frag_ep = None; + if let Some(ref module_spec) = params.fragment_module { + let full_path = input.input_directory().join(&module_spec.path); + + assert_eq!( + full_path.extension().unwrap().to_string_lossy(), + "wgsl", + "Currently all fragment modules must be in WGSL" + ); + + let frag_src = fs::read_to_string(full_path).unwrap(); + + frag_module = naga::front::wgsl::parse_str(&frag_src) + .expect("Failed to parse fragment module"); + + frag_ep = Some( + naga::back::hlsl::FragmentEntryPoint::new( + &frag_module, + &module_spec.entry_point, + ) + .expect("Could not find fragment entry point"), + ); + } + write_output_hlsl( input, module, @@ -677,375 +734,25 @@ fn write_output_wgsl( #[cfg(feature = "wgsl-in")] #[test] -fn convert_wgsl() { +fn convert_snapshots_wgsl() { let _ = env_logger::try_init(); - let inputs = [ - ( - "array-in-ctor", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "array-in-function-return-type", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "empty", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "quad", - Targets::SPIRV - | Targets::METAL - | Targets::GLSL - | Targets::DOT - | Targets::HLSL - | Targets::WGSL, - ), - ( - "bits", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "bitcast", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "boids", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "skybox", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "collatz", - Targets::SPIRV - | Targets::METAL - | Targets::IR - | Targets::ANALYSIS - | Targets::HLSL - | Targets::WGSL, - ), - ( - "shadow", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "image", - Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL | Targets::GLSL, - ), - ("extra", Targets::SPIRV | Targets::METAL | Targets::WGSL), - ("push-constants", Targets::GLSL | Targets::HLSL), - ( - "operators", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "functions", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "fragment-output", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "dualsource", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("functions-webgl", Targets::GLSL), - ( - "interpolate", - Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL, - ), - ( - "interpolate_compat", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "access", - Targets::SPIRV - | Targets::METAL - | Targets::GLSL - | Targets::HLSL - | Targets::WGSL - | Targets::IR - | Targets::ANALYSIS, - ), - ( - "atomicOps", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "atomicCompareExchange", - Targets::SPIRV | Targets::METAL | Targets::WGSL, - ), - ( - "padding", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "atomicOps-int64", - Targets::SPIRV | Targets::HLSL | Targets::WGSL, - ), - ( - "atomicOps-int64-min-max", - Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL, - ), - ( - "atomicTexture", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "atomicOps-float32", - Targets::SPIRV | Targets::METAL | Targets::WGSL, - ), - ( - "atomicTexture-int64", - Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL, - ), - ( - "atomicCompareExchange-int64", - Targets::SPIRV | Targets::WGSL, - ), - ("pointers", Targets::SPIRV | Targets::WGSL), - ( - "control-flow", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "standard", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - //TODO: GLSL https://github.com/gfx-rs/naga/issues/874 - ( - "interface", - Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL, - ), - ( - "globals", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("bounds-check-zero", Targets::SPIRV | Targets::METAL), - ("bounds-check-zero-atomic", Targets::METAL), - ("bounds-check-restrict", Targets::SPIRV | Targets::METAL), - ( - "bounds-check-image-restrict", - Targets::SPIRV | Targets::METAL | Targets::GLSL, - ), - ( - "bounds-check-image-rzsw", - Targets::SPIRV | Targets::METAL | Targets::GLSL, - ), - ("policy-mix", Targets::SPIRV | Targets::METAL), - ("bounds-check-dynamic-buffer", Targets::HLSL), - ( - "texture-arg", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("cubeArrayShadow", Targets::GLSL), - ("sample-cube-array-depth-lod", Targets::GLSL), - ( - "use-gl-ext-over-grad-workaround-if-instructed", - Targets::GLSL, - ), - ("local-const", Targets::IR | Targets::WGSL), - ( - "math-functions", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "binding-arrays", - Targets::WGSL | Targets::HLSL | Targets::METAL | Targets::SPIRV, - ), - ( - "binding-buffer-arrays", - Targets::WGSL | Targets::SPIRV, //TODO: more backends, eventually merge into "binding-arrays" - ), - ("resource-binding-map", Targets::METAL), - ("multiview", Targets::SPIRV | Targets::GLSL | Targets::WGSL), - ("multiview_webgl", Targets::GLSL), - ( - "break-if", - Targets::WGSL | Targets::GLSL | Targets::SPIRV | Targets::HLSL | Targets::METAL, - ), - ("lexical-scopes", Targets::WGSL), - ("type-alias", Targets::WGSL), - ("module-scope", Targets::WGSL), - ( - "workgroup-var-init", - Targets::WGSL | Targets::GLSL | Targets::SPIRV | Targets::HLSL | Targets::METAL, - ), - ( - "workgroup-uniform-load", - Targets::WGSL | Targets::GLSL | Targets::SPIRV | Targets::HLSL | Targets::METAL, - ), - ("runtime-array-in-unused-struct", Targets::SPIRV), - ("sprite", Targets::SPIRV), - ("force_point_size_vertex_shader_webgl", Targets::GLSL), - ("invariant", Targets::GLSL), - ("ray-query", Targets::SPIRV | Targets::METAL | Targets::HLSL), - ("hlsl-keyword", Targets::HLSL), - ( - "constructors", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("msl-varyings", Targets::METAL), - ( - "const-exprs", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("const_assert", Targets::WGSL | Targets::IR), - ("separate-entry-points", Targets::SPIRV | Targets::GLSL), - ( - "struct-layout", - Targets::WGSL | Targets::GLSL | Targets::SPIRV | Targets::HLSL | Targets::METAL, - ), - ( - "f64", - Targets::SPIRV | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "abstract-types-const", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL, - ), - ( - "abstract-types-function-calls", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL, - ), - ( - "abstract-types-var", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL, - ), - ( - "abstract-types-operators", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::WGSL, - ), - ( - "abstract-types-return", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "int64", - Targets::SPIRV | Targets::HLSL | Targets::WGSL | Targets::METAL, - ), - ( - "subgroup-operations", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "overrides", - Targets::IR - | Targets::ANALYSIS - | Targets::SPIRV - | Targets::METAL - | Targets::HLSL - | Targets::GLSL, - ), - ( - "overrides-atomicCompareExchangeWeak", - Targets::IR | Targets::SPIRV | Targets::METAL, - ), - ( - "overrides-ray-query", - Targets::IR | Targets::SPIRV | Targets::METAL, - ), - ("vertex-pulling-transform", Targets::METAL), - ( - "cross", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ( - "phony_assignment", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("6220-break-from-loop", Targets::SPIRV), - ("index-by-value", Targets::SPIRV | Targets::IR), - ( - "6438-conflicting-idents", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("diagnostic-filter", Targets::IR), - ( - "6772-unpack-expr-accesses", - Targets::SPIRV | Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ), - ("must-use", Targets::IR), - ( - "storage-textures", - Targets::IR | Targets::ANALYSIS | Targets::SPIRV | Targets::METAL | Targets::HLSL, - ), - ]; - - for &(name, targets) in inputs.iter() { - // WGSL shaders lives in root dir as a privileged. - let input = Input::new(None, name, "wgsl"); + for input in Input::files_in_dir(None, &["wgsl"]) { let source = input.read_source(); + // crlf will make the large split output different on different platform + let source = source.replace('\r', ""); match naga::front::wgsl::parse_str(&source) { - Ok(mut module) => check_targets(&input, &mut module, targets, None, None), + Ok(mut module) => check_targets(&input, &mut module, Some(&source)), Err(e) => panic!( "{}", e.emit_to_string_with_path(&source, input.input_path()) ), } } - - { - let inputs = [ - ("debug-symbol-simple", Targets::SPIRV), - ("debug-symbol-terrain", Targets::SPIRV), - ("debug-symbol-large-source", Targets::SPIRV), - ]; - for &(name, targets) in inputs.iter() { - // WGSL shaders lives in root dir as a privileged. - let input = Input::new(None, name, "wgsl"); - let source = input.read_source(); - - // crlf will make the large split output different on different platform - let source = source.replace('\r', ""); - match naga::front::wgsl::parse_str(&source) { - Ok(mut module) => check_targets(&input, &mut module, targets, Some(&source), None), - Err(e) => panic!( - "{}", - e.emit_to_string_with_path(&source, input.input_path()) - ), - } - } - } -} - -#[cfg(all(feature = "wgsl-in", hlsl_out))] -#[test] -fn unconsumed_vertex_outputs_hlsl_out() { - let load_and_parse = |name| { - // WGSL shaders lives in root dir as a privileged. - let input = Input::new(None, name, "wgsl"); - let source = input.read_source(); - let module = match naga::front::wgsl::parse_str(&source) { - Ok(module) => module, - Err(e) => panic!( - "{}", - e.emit_to_string_with_path(&source, input.input_path()) - ), - }; - (input, module) - }; - - // Uses separate wgsl files to make sure the tested code doesn't accidentally rely on - // the fragment entry point being from the same parsed content (e.g. accidentally using the - // wrong `Module` when looking up info). We also don't just create a module from the same file - // twice since everything would probably be stored behind the same keys. - let (input, mut module) = load_and_parse("unconsumed_vertex_outputs_vert"); - let (frag_input, mut frag_module) = load_and_parse("unconsumed_vertex_outputs_frag"); - let frag_ep = naga::back::hlsl::FragmentEntryPoint::new(&frag_module, "fs_main") - .expect("fs_main not found"); - - check_targets(&input, &mut module, Targets::HLSL, None, Some(frag_ep)); - check_targets(&frag_input, &mut frag_module, Targets::HLSL, None, None); } #[cfg(feature = "spv-in")] -fn convert_spv(name: &str, adjust_coordinate_space: bool, targets: Targets) { +fn convert_spv(name: &str, adjust_coordinate_space: bool) { use std::process::Command; let _ = env_logger::try_init(); @@ -1084,136 +791,66 @@ fn convert_spv(name: &str, adjust_coordinate_space: bool, targets: Targets) { ) .unwrap(); - check_targets(&input, &mut module, targets, None, None); + check_targets(&input, &mut module, None); } #[cfg(feature = "spv-in")] #[test] -fn convert_spv_all() { - convert_spv( - "quad-vert", - false, - Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ); - convert_spv("shadow", true, Targets::IR | Targets::ANALYSIS); - convert_spv( - "inv-hyperbolic-trig-functions", - true, - Targets::HLSL | Targets::WGSL, - ); - convert_spv( - "empty-global-name", - true, - Targets::HLSL | Targets::WGSL | Targets::METAL, - ); - convert_spv("degrees", false, Targets::empty()); - convert_spv("binding-arrays.dynamic", true, Targets::WGSL); - convert_spv("binding-arrays.static", true, Targets::WGSL); - convert_spv( - "do-while", - true, - Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ); - convert_spv( - "unnamed-gl-per-vertex", - true, - Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ); - convert_spv("builtin-accessed-outside-entrypoint", true, Targets::WGSL); - convert_spv("spec-constants", true, Targets::IR); - convert_spv("spec-constants-issue-5598", true, Targets::GLSL); - convert_spv( - "subgroup-operations-s", - false, - Targets::METAL | Targets::GLSL | Targets::HLSL | Targets::WGSL, - ); - convert_spv("atomic_i_increment", false, Targets::WGSL); - convert_spv("atomic_load_and_store", false, Targets::WGSL); - convert_spv("atomic_exchange", false, Targets::WGSL); - convert_spv("atomic_compare_exchange", false, Targets::WGSL); - convert_spv("atomic_i_decrement", false, Targets::WGSL); - convert_spv("atomic_i_add_sub", false, Targets::WGSL); - convert_spv("atomic_global_struct_field_vertex", false, Targets::WGSL); - convert_spv( - "fetch_depth", - false, - Targets::IR | Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL, - ); -} - -#[cfg(feature = "glsl-in")] -#[test] -fn convert_glsl_variations_check() { - let input = Input::new(None, "variations", "glsl"); - let source = input.read_source(); - let mut parser = naga::front::glsl::Frontend::default(); - let mut module = parser - .parse( - &naga::front::glsl::Options { - stage: naga::ShaderStage::Fragment, - defines: Default::default(), - }, - &source, - ) - .unwrap(); - check_targets(&input, &mut module, Targets::GLSL, None, None); +fn convert_snapshots_spv() { + convert_spv("quad-vert", false); + convert_spv("shadow", true); + convert_spv("inv-hyperbolic-trig-functions", true); + convert_spv("empty-global-name", true); + convert_spv("degrees", false); + convert_spv("binding-arrays.dynamic", true); + convert_spv("binding-arrays.static", true); + convert_spv("do-while", true); + convert_spv("unnamed-gl-per-vertex", true); + convert_spv("builtin-accessed-outside-entrypoint", true); + convert_spv("spec-constants", true); + convert_spv("spec-constants-issue-5598", true); + convert_spv("subgroup-operations-s", false); + convert_spv("atomic_i_increment", false); + convert_spv("atomic_load_and_store", false); + convert_spv("atomic_exchange", false); + convert_spv("atomic_compare_exchange", false); + convert_spv("atomic_i_decrement", false); + convert_spv("atomic_i_add_sub", false); + convert_spv("atomic_global_struct_field_vertex", false); + convert_spv("fetch_depth", false); } #[cfg(feature = "glsl-in")] #[allow(unused_variables)] #[test] -fn convert_glsl_folder() { +fn convert_snapshots_glsl() { let _ = env_logger::try_init(); - for input in Input::files_in_dir("glsl") { + for input in Input::files_in_dir(Some("glsl"), &["vert", "frag", "comp"]) { let input = Input { keep_input_extension: true, ..input }; let file_name = &input.file_name; - if file_name.ends_with(".ron") { - // No needed to validate ron files - continue; - } + + let stage = match file_name.extension().and_then(|s| s.to_str()).unwrap() { + "vert" => naga::ShaderStage::Vertex, + "frag" => naga::ShaderStage::Fragment, + "comp" => naga::ShaderStage::Compute, + ext => panic!("Unknown extension for glsl file {ext}"), + }; let mut parser = naga::front::glsl::Frontend::default(); let mut module = parser .parse( &naga::front::glsl::Options { - stage: match file_name.extension().and_then(|s| s.to_str()).unwrap() { - "vert" => naga::ShaderStage::Vertex, - "frag" => naga::ShaderStage::Fragment, - "comp" => naga::ShaderStage::Compute, - ext => panic!("Unknown extension for glsl file {ext}"), - }, + stage, defines: Default::default(), }, &input.read_source(), ) .unwrap(); - let info = naga::valid::Validator::new( - naga::valid::ValidationFlags::all(), - naga::valid::Capabilities::all(), - ) - .validate(&module) - .unwrap(); - - #[cfg(feature = "compact")] - let info = { - naga::compact::compact(&mut module); - - naga::valid::Validator::new( - naga::valid::ValidationFlags::all(), - naga::valid::Capabilities::all(), - ) - .validate(&module) - .unwrap() - }; - - #[cfg(wgsl_out)] - { - write_output_wgsl(&input, &module, &info, &WgslOutParameters::default()); - } + check_targets(&input, &mut module, None); } }